采购订单问题

pro
anthonywj 2 years ago
parent a90aed66fc
commit f3b92944ae

@ -116,7 +116,10 @@ public class PurOrderController {
if (purOrderRequest.getStatus() == null) {
purOrderRequest.setStatus(11); //查询未审核和草稿状态
}
String customerId = customerService.getCustomerId();
if (!customerId.equals("110")) {
purOrderRequest.setSupId(customerId);
}
List<PurOrderResponse> purApplyEntities = purOrderService.queryPageList(purOrderRequest);
PageInfo<PurOrderResponse> pageInfo;
pageInfo = new PageInfo<>(purApplyEntities);
@ -156,7 +159,7 @@ public class PurOrderController {
purOrderEntity.setUpdateTime(new Date());
purOrderService.update(purOrderEntity);
if(postPurOrderRequest.isAutoPurchase() && StrUtil.isNotEmpty(postPurOrderRequest.getTargetBillAction())){
if (postPurOrderRequest.isAutoPurchase() && StrUtil.isNotEmpty(postPurOrderRequest.getTargetBillAction())) {
String billNo = "";
List<PurOrderDetailEntity> purOrderDetailEntities = purOrderDetailService.findByOrderId(purOrderEntity.getId() + "");
@ -164,61 +167,59 @@ public class PurOrderController {
Map<String, List<PurOrderDetailEntity>> map = purOrderDetailEntities.stream().collect(Collectors.groupingBy(PurOrderDetailEntity::getSupId));
if (CollUtil.isNotEmpty(purOrderDetailEntities) && postPurOrderRequest.isAutoPurchase() == true
&& StrUtil.isNotEmpty(postPurOrderRequest.getTargetBillAction())) {
if (CollUtil.isNotEmpty(purOrderDetailEntities) && postPurOrderRequest.isAutoPurchase() == true
&& StrUtil.isNotEmpty(postPurOrderRequest.getTargetBillAction())) {
for (Map.Entry<String, List<PurOrderDetailEntity>> 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(postPurOrderRequest.getTargetBillAction());
ioOrderEntity.setFromCorp(m.getKey());
ioOrderEntity.setFromType(ConstantStatus.FROM_Order);
ioOrderEntity.setStatus(1);
ioOrderEntity.setDealStatus(1);
ioOrderEntity.setOrderType(1);
ioOrderEntity.setCreateTime(new Date());
ioOrderEntity.setCreateUser(postPurOrderRequest.getPurOrderEntity().getAuditUser());
ioOrderEntity.setUpdateTime(new Date());
ioOrderEntity.setUpdateUser(postPurOrderRequest.getPurOrderEntity().getAuditUser());
ioOrderEntity.setCustomerId("110");
ioOrderEntity.setDeptCode(purOrderEntity.getDeptCode());
ioOrderEntity.setInvCode(purOrderEntity.getInvCode());
ioOrderService.insertOrder(ioOrderEntity);
billNo += ioOrderEntity.getBillNo() + ",";
//插入业务单表
for (PurOrderDetailEntity obj : m.getValue()) {
BasicProductsEntity basicProductsEntity = purOrderDetailService.selectIoOrderDetailBiz(obj.getId());
IoOrderDetailBizEntity ioOrderDetailBizEntity = new IoOrderDetailBizEntity();
ioOrderDetailBizEntity.setOrderIdFk(ioOrderEntity.getBillNo());
ioOrderDetailBizEntity.setBindRlFk(Long.valueOf(obj.getProductId()));
ioOrderDetailBizEntity.setCount(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());
if (basicProductsEntity.getPrice() != null) {
ioOrderDetailBizEntity.setPrice(BigDecimal.valueOf(basicProductsEntity.getPrice()));
}
ioOrderDetailBizEntity.setSupId(obj.getSupId());
ioOrderDetailBizService.insert(ioOrderDetailBizEntity);
for (Map.Entry<String, List<PurOrderDetailEntity>> 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(postPurOrderRequest.getTargetBillAction());
ioOrderEntity.setFromCorp(m.getKey());
ioOrderEntity.setFromType(ConstantStatus.FROM_Order);
ioOrderEntity.setStatus(1);
ioOrderEntity.setDealStatus(1);
ioOrderEntity.setOrderType(1);
ioOrderEntity.setCreateTime(new Date());
ioOrderEntity.setCreateUser(postPurOrderRequest.getPurOrderEntity().getAuditUser());
ioOrderEntity.setUpdateTime(new Date());
ioOrderEntity.setUpdateUser(postPurOrderRequest.getPurOrderEntity().getAuditUser());
ioOrderEntity.setCustomerId("110");
ioOrderEntity.setDeptCode(purOrderEntity.getDeptCode());
ioOrderEntity.setInvCode(purOrderEntity.getInvCode());
ioOrderService.insertOrder(ioOrderEntity);
billNo += ioOrderEntity.getBillNo() + ",";
//插入业务单表
for (PurOrderDetailEntity obj : m.getValue()) {
BasicProductsEntity basicProductsEntity = purOrderDetailService.selectIoOrderDetailBiz(obj.getId());
IoOrderDetailBizEntity ioOrderDetailBizEntity = new IoOrderDetailBizEntity();
ioOrderDetailBizEntity.setOrderIdFk(ioOrderEntity.getBillNo());
ioOrderDetailBizEntity.setBindRlFk(Long.valueOf(obj.getProductId()));
ioOrderDetailBizEntity.setCount(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());
if (basicProductsEntity.getPrice() != null) {
ioOrderDetailBizEntity.setPrice(BigDecimal.valueOf(basicProductsEntity.getPrice()));
}
ioOrderDetailBizEntity.setSupId(obj.getSupId());
ioOrderDetailBizService.insert(ioOrderDetailBizEntity);
}
purOrderEntity.setStockOrderNo(billNo.substring(0, billNo.length() - 1));
purOrderService.update(purOrderEntity);
}
purOrderEntity.setStockOrderNo(billNo.substring(0, billNo.length() - 1));
purOrderService.update(purOrderEntity);
}
}
return ResultVOUtils.success("更新成功!");
}

@ -81,6 +81,7 @@ public class PurOrderRequest extends ListPageRequest {
private Date auditTime;
private String createUser;
private String supId;
/**
*

@ -40,12 +40,15 @@
cb.employeeName createUserName,
ab.employeeName auditUserName,
auth_warehouse.NAME invName,
auth_dept.`name` deptName
auth_dept.`name` deptName,
basic_corp.name supName
FROM pur_order
LEFT JOIN auth_user cb ON pur_order.createUser = cb.id
LEFT JOIN auth_user ab ON pur_order.auditUser = ab.id
LEFT JOIN auth_warehouse ON pur_order.invCode = auth_warehouse.`code`
LEFT JOIN auth_dept ON auth_dept.CODE = pur_order.deptCode
left join basic_corp on pur_order.supId = basic_corp.erpId
<where>
<if test="billNo != '' and billNo != null">
AND billNo = #{billNo}
@ -92,6 +95,9 @@
<if test="auditUser != '' and auditUser != null">
AND auditUser = #{auditUser}
</if>
<if test="supId != null and supId != ''">
AND pur_order.supId = #{supId}
</if>
<if test="createUser != '' and createUser != null">
AND createUser = #{createUser}
</if>

Loading…
Cancel
Save