申购计划审核生成业务单据bug修改

master
郑明梁 2 years ago
parent 3bfb013a2c
commit b911d27085

@ -168,23 +168,29 @@ public class PurPlanController {
purApplyEntity.setAuditUser(userId + ""); purApplyEntity.setAuditUser(userId + "");
purApplyEntity.setStatus(postPurPlanRequest.getEditStatus()); purApplyEntity.setStatus(postPurPlanRequest.getEditStatus());
purPlanService.update(purApplyEntity); purPlanService.update(purApplyEntity);
String billNo="";
List<PurPlanDetailEntity> purPlanDetailEntities = purPlanDetailService.findByOrderId(purApplyEntity.getId() + ""); List<PurPlanDetailEntity> purPlanDetailEntities = purPlanDetailService.findByOrderId(purApplyEntity.getId() + "");
//对计划单里面的供应商进行分组
Map<String, List<PurPlanDetailEntity>> map = purPlanDetailEntities.stream().collect(Collectors.groupingBy(PurPlanDetailEntity::getSupId));
if (postPurPlanRequest.getEditStatus() == ConstantStatus.APPLY_AUDIT_ED) { if (postPurPlanRequest.getEditStatus() == ConstantStatus.APPLY_AUDIT_ED) {
if (CollUtil.isNotEmpty(purPlanDetailEntities) && postPurPlanRequest.isAutoPurchase()==true if (CollUtil.isNotEmpty(purPlanDetailEntities) && postPurPlanRequest.isAutoPurchase()==true
&& StrUtil.isNotEmpty(postPurPlanRequest.getTargetSubInv()) && StrUtil.isNotEmpty(postPurPlanRequest.getTargetBillAction()) ) { && StrUtil.isNotEmpty(postPurPlanRequest.getTargetSubInv()) && StrUtil.isNotEmpty(postPurPlanRequest.getTargetBillAction()) ) {
for (Map.Entry<String, List<PurPlanDetailEntity>> m:map.entrySet()) {
//生产单据表信息 //生产单据表信息
IoOrderEntity ioOrderEntity=new IoOrderEntity(); IoOrderEntity ioOrderEntity=new IoOrderEntity();
ioOrderEntity.setBillNo(gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER ,"yyyyMMdd"))); ioOrderEntity.setBillNo(gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER ,"yyyyMMdd")));
ioOrderEntity.setCorpOrderId(CustomUtil.getDate()); ioOrderEntity.setCorpOrderId(CustomUtil.getDate());
ioOrderEntity.setMainAction(ConstantType.TYPE_PUT); ioOrderEntity.setMainAction(ConstantType.TYPE_PUT);
ioOrderEntity.setAction(postPurPlanRequest.getTargetBillAction()); ioOrderEntity.setAction(postPurPlanRequest.getTargetBillAction());
ioOrderEntity.setFromCorp("1111"); ioOrderEntity.setFromCorp(m.getKey());
ioOrderEntity.setFromType(ConstantStatus.FROM_PLAN); ioOrderEntity.setFromType(ConstantStatus.FROM_PLAN);
ioOrderEntity.setStatus(1); ioOrderEntity.setStatus(1);
ioOrderEntity.setDealStatus(1); ioOrderEntity.setDealStatus(1);
ioOrderEntity.setOrderType(1);
ioOrderEntity.setCreateTime(new Date()); ioOrderEntity.setCreateTime(new Date());
ioOrderEntity.setCreateUser(postPurPlanRequest.getPurPlanEntity().getAuditUser()); ioOrderEntity.setCreateUser(postPurPlanRequest.getPurPlanEntity().getAuditUser());
ioOrderEntity.setUpdateTime(new Date()); ioOrderEntity.setUpdateTime(new Date());
@ -193,15 +199,12 @@ public class PurPlanController {
ioOrderEntity.setDeptCode(postPurPlanRequest.getTargetDeptCode()); ioOrderEntity.setDeptCode(postPurPlanRequest.getTargetDeptCode());
ioOrderEntity.setInvCode(postPurPlanRequest.getTargetSubInv()); ioOrderEntity.setInvCode(postPurPlanRequest.getTargetSubInv());
ioOrderService.insertOrder(ioOrderEntity); ioOrderService.insertOrder(ioOrderEntity);
billNo+=ioOrderEntity.getBillNo()+",";
//插入业务单表 //插入业务单表
//查询详情表 for (PurPlanDetailEntity obj:m.getValue()) {
List<PurPlanDetailEntity> purPlanDetailEntityList=purPlanDetailService.findByOrderId(postPurPlanRequest.getPurPlanEntity().getId()+""); BasicProductsEntity basicProductsEntity = purPlanDetailService.selectIoOrderDetailBiz(obj.getId());
for (PurPlanDetailEntity obj:purPlanDetailEntityList){ IoOrderDetailBizEntity ioOrderDetailBizEntity = new IoOrderDetailBizEntity();
ioOrderDetailBizEntity.setOrderIdFk(ioOrderEntity.getBillNo());
BasicProductsEntity basicProductsEntity=purPlanDetailService.selectIoOrderDetailBiz(obj.getId());
IoOrderDetailBizEntity ioOrderDetailBizEntity=new IoOrderDetailBizEntity();
ioOrderDetailBizEntity.setOrderIdFk(ioOrderEntity.getId()+"");
ioOrderDetailBizEntity.setBindRlFk(Long.valueOf(obj.getProductId())); ioOrderDetailBizEntity.setBindRlFk(Long.valueOf(obj.getProductId()));
ioOrderDetailBizEntity.setCount(obj.getCount()); ioOrderDetailBizEntity.setCount(obj.getCount());
ioOrderDetailBizEntity.setUuidFk(basicProductsEntity.getUuid()); ioOrderDetailBizEntity.setUuidFk(basicProductsEntity.getUuid());
@ -212,14 +215,14 @@ public class PurPlanController {
ioOrderDetailBizEntity.setManufacturer(basicProductsEntity.getManufactory()); ioOrderDetailBizEntity.setManufacturer(basicProductsEntity.getManufactory());
ioOrderDetailBizEntity.setMeasname(basicProductsEntity.getMeasname()); ioOrderDetailBizEntity.setMeasname(basicProductsEntity.getMeasname());
ioOrderDetailBizEntity.setSpec(basicProductsEntity.getGgxh()); ioOrderDetailBizEntity.setSpec(basicProductsEntity.getGgxh());
if(basicProductsEntity.getPrice()!=null) { if (basicProductsEntity.getPrice() != null) {
ioOrderDetailBizEntity.setPrice(BigDecimal.valueOf(basicProductsEntity.getPrice())); ioOrderDetailBizEntity.setPrice(BigDecimal.valueOf(basicProductsEntity.getPrice()));
} }
ioOrderDetailBizEntity.setSupId(obj.getSupId()); ioOrderDetailBizEntity.setSupId(obj.getSupId());
ioOrderDetailBizService.insert(ioOrderDetailBizEntity); ioOrderDetailBizService.insert(ioOrderDetailBizEntity);
} }
}
purApplyEntity.setStockOrderNo(ioOrderEntity.getBillNo()); purApplyEntity.setStockOrderNo(billNo.substring(0,billNo.length()-1));
purPlanService.update(purApplyEntity); purPlanService.update(purApplyEntity);
} }
} }

@ -46,7 +46,7 @@
AND supId = #{supId} AND supId = #{supId}
</if> </if>
</where> </where>
GROUP BY basic_products.uuid
</select> </select>
<insert id="insert" keyProperty="id" <insert id="insert" keyProperty="id"

@ -127,7 +127,7 @@
AND p1.id = #{id} AND p1.id = #{id}
</if> </if>
</where> </where>
GROUP BY uuid
</select> </select>
</mapper> </mapper>
Loading…
Cancel
Save