|
|
|
@ -256,53 +256,57 @@ public class IoPurChangeService {
|
|
|
|
|
BasicBusTypeChangeEntity basicBusTypeChangeEntity = basicBusTypeChangeService.selectByOriginAction(ConstantStatus.BUS_ORDER_HCLY);
|
|
|
|
|
purReceiveEntity = receiveService.selectById(purReceiveEntity.getId());
|
|
|
|
|
List<PurReceiveDetailEntity> purReceiveDetailEntityList = receivedetailService.selectByOrderId(purReceiveEntity.getBillNo());
|
|
|
|
|
Map<String, List<PurReceiveDetailEntity>> map = purReceiveDetailEntityList.stream().collect(Collectors.groupingBy(PurReceiveDetailEntity::getSupId));
|
|
|
|
|
// Map<String, List<PurReceiveDetailEntity>> map = purReceiveDetailEntityList.stream().collect(Collectors.groupingBy(PurReceiveDetailEntity::getSupId));
|
|
|
|
|
String billNo = "";
|
|
|
|
|
if (basicBusTypeChangeEntity != null && StrUtil.isNotEmpty(basicBusTypeChangeEntity.getTargetAction()) && basicBusTypeChangeEntity.isEnable() == true) {
|
|
|
|
|
for (Map.Entry<String, List<PurReceiveDetailEntity>> m : map.entrySet()) {
|
|
|
|
|
//生产单据表信息
|
|
|
|
|
IoOrderEntity ioOrderEntity = new IoOrderEntity();
|
|
|
|
|
ioOrderEntity.setBillNo(gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER, "yyyyMMdd")));
|
|
|
|
|
ioOrderEntity.setCorpOrderId(CustomUtil.getDate());
|
|
|
|
|
ioOrderEntity.setMainAction(ConstantType.TYPE_PUT);
|
|
|
|
|
ioOrderEntity.setAction(basicBusTypeChangeEntity.getTargetAction());
|
|
|
|
|
ioOrderEntity.setFromCorp(m.getKey());
|
|
|
|
|
ioOrderEntity.setFromType(ConstantStatus.FROM_PLAN);
|
|
|
|
|
if (basicBusTypeChangeEntity.getAuditStatus() == 1) {
|
|
|
|
|
ioOrderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);
|
|
|
|
|
ioOrderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT);
|
|
|
|
|
} else {
|
|
|
|
|
ioOrderEntity.setStatus(ConstantStatus.ORDER_STATUS_CHECK);
|
|
|
|
|
ioOrderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_POST);
|
|
|
|
|
}
|
|
|
|
|
ioOrderEntity.setOrderType(1);
|
|
|
|
|
ioOrderEntity.setCreateTime(new Date());
|
|
|
|
|
ioOrderEntity.setCreateUser(purReceiveEntity.getCreateUser());
|
|
|
|
|
ioOrderEntity.setUpdateTime(new Date());
|
|
|
|
|
ioOrderEntity.setUpdateUser(purReceiveEntity.getCreateUser());
|
|
|
|
|
ioOrderEntity.setCustomerId("110");
|
|
|
|
|
ioOrderEntity.setDeptCode(purReceiveEntity.getInvCode());
|
|
|
|
|
ioOrderEntity.setInvCode(purReceiveEntity.getDeptCode());
|
|
|
|
|
ioOrderService.insertOrder(ioOrderEntity);
|
|
|
|
|
billNo += ioOrderEntity.getBillNo() + ",";
|
|
|
|
|
//插入业务单表
|
|
|
|
|
for (PurReceiveDetailEntity obj : m.getValue()) {
|
|
|
|
|
BasicProductsEntity basicProductsEntity = receivedetailService.selectIoOrderDetailBiz(obj.getId());
|
|
|
|
|
IoOrderDetailBizEntity ioOrderDetailBizEntity = new IoOrderDetailBizEntity();
|
|
|
|
|
ioOrderDetailBizEntity.setOrderIdFk(ioOrderEntity.getBillNo());
|
|
|
|
|
ioOrderDetailBizEntity.setBindRlFk(obj.getRelIdFk());
|
|
|
|
|
ioOrderDetailBizEntity.setCount(IntUtil.value(obj.getCount()));
|
|
|
|
|
ioOrderDetailBizEntity.setUuidFk(basicProductsEntity.getUuid());
|
|
|
|
|
ioOrderDetailBizEntity.setNameCode(basicProductsEntity.getNameCode());
|
|
|
|
|
ioOrderDetailBizEntity.setCoName(basicProductsEntity.getCpmctymc());
|
|
|
|
|
ioOrderDetailBizEntity.setCertCode(basicProductsEntity.getZczbhhzbapzbh());
|
|
|
|
|
ioOrderDetailBizEntity.setYlqxzcrbarmc(basicProductsEntity.getYlqxzcrbarmc());
|
|
|
|
|
ioOrderDetailBizEntity.setManufacturer(basicProductsEntity.getManufactory()); ioOrderDetailBizEntity.setMeasname(basicProductsEntity.getMeasname());
|
|
|
|
|
ioOrderDetailBizEntity.setSpec(basicProductsEntity.getGgxh());
|
|
|
|
|
ioOrderDetailBizEntity.setPrice(obj.getPrice());
|
|
|
|
|
ioOrderDetailBizEntity.setSupId(obj.getSupId());
|
|
|
|
|
ioOrderDetailBizService.insert(ioOrderDetailBizEntity);
|
|
|
|
|
}
|
|
|
|
|
//生产单据表信息
|
|
|
|
|
IoOrderEntity ioOrderEntity = new IoOrderEntity();
|
|
|
|
|
ioOrderEntity.setBillNo(gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER, "yyyyMMdd")));
|
|
|
|
|
ioOrderEntity.setCorpOrderId(purReceiveEntity.getBillNo());
|
|
|
|
|
ioOrderEntity.setFromReceiveBillNo(purReceiveEntity.getBillNo());
|
|
|
|
|
ioOrderEntity.setMainAction(ConstantType.TYPE_PUT);
|
|
|
|
|
ioOrderEntity.setAction(basicBusTypeChangeEntity.getTargetAction());
|
|
|
|
|
ioOrderEntity.setFromDeptCode(purReceiveEntity.getTargetDeptCode());
|
|
|
|
|
ioOrderEntity.setFromInvCode(purReceiveEntity.getTargetInvCode());
|
|
|
|
|
ioOrderEntity.setFromType(ConstantStatus.FROM_RECEIVE);
|
|
|
|
|
if (basicBusTypeChangeEntity.getAuditStatus() == 1) {
|
|
|
|
|
ioOrderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);
|
|
|
|
|
ioOrderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT);
|
|
|
|
|
} else {
|
|
|
|
|
ioOrderEntity.setStatus(ConstantStatus.ORDER_STATUS_CHECK);
|
|
|
|
|
ioOrderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_POST);
|
|
|
|
|
}
|
|
|
|
|
ioOrderEntity.setOrderType(1);
|
|
|
|
|
ioOrderEntity.setCreateTime(new Date());
|
|
|
|
|
ioOrderEntity.setCreateUser(purReceiveEntity.getCreateUser());
|
|
|
|
|
ioOrderEntity.setUpdateTime(new Date());
|
|
|
|
|
ioOrderEntity.setUpdateUser(purReceiveEntity.getCreateUser());
|
|
|
|
|
ioOrderEntity.setCustomerId("110");
|
|
|
|
|
ioOrderEntity.setDeptCode(purReceiveEntity.getDeptCode());
|
|
|
|
|
ioOrderEntity.setInvCode(purReceiveEntity.getInvCode());
|
|
|
|
|
ioOrderService.insertOrder(ioOrderEntity);
|
|
|
|
|
billNo += ioOrderEntity.getBillNo() + ",";
|
|
|
|
|
//插入业务单表
|
|
|
|
|
for (PurReceiveDetailEntity obj : purReceiveDetailEntityList) {
|
|
|
|
|
BasicProductsEntity basicProductsEntity = receivedetailService.selectIoOrderDetailBiz(obj.getId());
|
|
|
|
|
IoOrderDetailBizEntity ioOrderDetailBizEntity = new IoOrderDetailBizEntity();
|
|
|
|
|
ioOrderDetailBizEntity.setOrderIdFk(ioOrderEntity.getBillNo());
|
|
|
|
|
ioOrderDetailBizEntity.setBindRlFk(obj.getRelIdFk());
|
|
|
|
|
ioOrderDetailBizEntity.setCount(IntUtil.value(obj.getCount()));
|
|
|
|
|
ioOrderDetailBizEntity.setUuidFk(basicProductsEntity.getUuid());
|
|
|
|
|
ioOrderDetailBizEntity.setNameCode(basicProductsEntity.getNameCode());
|
|
|
|
|
ioOrderDetailBizEntity.setCoName(basicProductsEntity.getCpmctymc());
|
|
|
|
|
ioOrderDetailBizEntity.setCertCode(basicProductsEntity.getZczbhhzbapzbh());
|
|
|
|
|
ioOrderDetailBizEntity.setYlqxzcrbarmc(basicProductsEntity.getYlqxzcrbarmc());
|
|
|
|
|
ioOrderDetailBizEntity.setManufacturer(basicProductsEntity.getManufactory());
|
|
|
|
|
ioOrderDetailBizEntity.setProductDate(obj.getProductDate());
|
|
|
|
|
ioOrderDetailBizEntity.setExpireDate(obj.getExpireDate());
|
|
|
|
|
ioOrderDetailBizEntity.setBatchNo(obj.getBatchNo());
|
|
|
|
|
ioOrderDetailBizEntity.setMeasname(basicProductsEntity.getMeasname());
|
|
|
|
|
ioOrderDetailBizEntity.setSpec(basicProductsEntity.getGgxh());
|
|
|
|
|
ioOrderDetailBizEntity.setPrice(obj.getPrice());
|
|
|
|
|
ioOrderDetailBizEntity.setSupId(obj.getSupId());
|
|
|
|
|
ioOrderDetailBizService.insert(ioOrderDetailBizEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|