Browse Source

[feat] 修改采购订单生成采购入库单页面获取,获取传输的通知入库数据、通知到货数

dev
zhangsiqi 4 months ago
parent
commit
c5b887032b
  1. 3
      ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java
  2. 9
      ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java
  3. 2
      ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java
  4. 2
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderChildService.java
  5. 5
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderChildServiceImpl.java
  6. 17
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java
  7. 9
      ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml
  8. 21
      ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html

3
ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java

@ -157,6 +157,7 @@ public class PurchaseOrderController extends BaseController
// 生成采购订单编号 // 生成采购订单编号
// 执行主表插入操作 // 执行主表插入操作
purchaseOrderService.insertPurchaseOrder(purchaseOrder); purchaseOrderService.insertPurchaseOrder(purchaseOrder);
//物料的供应商整合,生成该订单相关的应付账款
return AjaxResult.success(); // 假设toAjax方法处理成功逻辑 return AjaxResult.success(); // 假设toAjax方法处理成功逻辑
} }
@RequiresPermissions("purchase:purchaseOrder:add") @RequiresPermissions("purchase:purchaseOrder:add")
@ -220,7 +221,7 @@ public class PurchaseOrderController extends BaseController
public Map<String, List<PurchaseOrderChild>> detailListGroupedBySupplier(String qualityOrderCode) { public Map<String, List<PurchaseOrderChild>> detailListGroupedBySupplier(String qualityOrderCode) {
PurchaseOrderChild purchaseOrderChild = new PurchaseOrderChild(); PurchaseOrderChild purchaseOrderChild = new PurchaseOrderChild();
purchaseOrderChild.setPurchaseOrderCode(qualityOrderCode); purchaseOrderChild.setPurchaseOrderCode(qualityOrderCode);
List<PurchaseOrderChild> allDetails = purchaseOrderChildService.selectPurchaseOrderChildList(purchaseOrderChild); List<PurchaseOrderChild> allDetails = purchaseOrderChildService.selectPurchaseOrderStorageByPurchaseOrderCode(qualityOrderCode);
Map<String, List< PurchaseOrderChild>> groupedDetails = allDetails.stream() Map<String, List< PurchaseOrderChild>> groupedDetails = allDetails.stream()
.collect(Collectors.groupingBy(PurchaseOrderChild::getSupplierCode)); .collect(Collectors.groupingBy(PurchaseOrderChild::getSupplierCode));
return groupedDetails; return groupedDetails;

9
ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java

@ -150,8 +150,6 @@ public class PurchaseOrderChild extends BaseEntity
@Excel(name = "实际已到货数量") @Excel(name = "实际已到货数量")
private Integer actualHasArrivedNum; private Integer actualHasArrivedNum;
private Integer notifyArrivedNum;
public Integer getNotifyHasArrivedNum() { public Integer getNotifyHasArrivedNum() {
return notifyHasArrivedNum; return notifyHasArrivedNum;
} }
@ -160,13 +158,6 @@ public class PurchaseOrderChild extends BaseEntity
this.notifyHasArrivedNum = notifyHasArrivedNum; this.notifyHasArrivedNum = notifyHasArrivedNum;
} }
public Integer getNotifyArrivedNum() {
return notifyArrivedNum;
}
public void setNotifyArrivedNum(Integer notifyArrivedNum) {
this.notifyArrivedNum = notifyArrivedNum;
}
private List<PurchaseQuoteChild> purchaseQuoteChildList; private List<PurchaseQuoteChild> purchaseQuoteChildList;

2
ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java

@ -78,4 +78,6 @@ public interface PurchaseOrderChildMapper
List<PurchaseOrderChild> selectPurchaseOrderChildByOrderCode(String purchaseOrderCode); List<PurchaseOrderChild> selectPurchaseOrderChildByOrderCode(String purchaseOrderCode);
List<PurchaseOrderChild> selectPurchaseOrderChildByOrderCodeTotal(String purchaseOrderCode); List<PurchaseOrderChild> selectPurchaseOrderChildByOrderCodeTotal(String purchaseOrderCode);
List<PurchaseOrderChild> selectPurchaseOrderStorageByPurchaseOrderCode(String purchaseOrderCode);
} }

2
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderChildService.java

@ -76,4 +76,6 @@ public interface IPurchaseOrderChildService
List<PurchaseOrderChild> selectPurchaseOrderChildByOrderCode(String purchaseOrderCode); List<PurchaseOrderChild> selectPurchaseOrderChildByOrderCode(String purchaseOrderCode);
List<PurchaseOrderChild> selectPurchaseOrderChildByOrderCodeTotal(String purchaseOrderCode); List<PurchaseOrderChild> selectPurchaseOrderChildByOrderCodeTotal(String purchaseOrderCode);
List<PurchaseOrderChild> selectPurchaseOrderStorageByPurchaseOrderCode(String purchaseOrderCode);
} }

5
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderChildServiceImpl.java

@ -135,4 +135,9 @@ public class PurchaseOrderChildServiceImpl implements IPurchaseOrderChildService
public List<PurchaseOrderChild> selectPurchaseOrderChildByOrderCodeTotal(String purchaseOrderCode){ public List<PurchaseOrderChild> selectPurchaseOrderChildByOrderCodeTotal(String purchaseOrderCode){
return purchaseOrderChildMapper.selectPurchaseOrderChildByOrderCodeTotal(purchaseOrderCode); return purchaseOrderChildMapper.selectPurchaseOrderChildByOrderCodeTotal(purchaseOrderCode);
} }
//查询入库单中有无相同采购单数据,已入库数为最新审核通过添加采购物料信息的作为需要的已入库数。如有总和采购单通知到货数为已通知到货数,否则为0,
@Override
public List<PurchaseOrderChild> selectPurchaseOrderStorageByPurchaseOrderCode(String purchaseOrderCode){
return purchaseOrderChildMapper.selectPurchaseOrderStorageByPurchaseOrderCode(purchaseOrderCode);
}
} }

17
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java

@ -6,6 +6,8 @@ import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.service.ICommonService; import com.ruoyi.common.service.ICommonService;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.financial.service.IFinancialAccountsPayableService;
import com.ruoyi.financial.service.impl.FinancialAccountsPayableServiceImpl;
import com.ruoyi.process.general.service.IProcessService; import com.ruoyi.process.general.service.IProcessService;
import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper; import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper;
import com.ruoyi.purchase.domain.PurchaseOrder; import com.ruoyi.purchase.domain.PurchaseOrder;
@ -92,6 +94,9 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
@Autowired @Autowired
private PurchasePlanMapper purchasePlanService; private PurchasePlanMapper purchasePlanService;
@Autowired
private IFinancialAccountsPayableService financialAccountsPayableService;
/** /**
* 查询采购订单 * 查询采购订单
* *
@ -303,8 +308,15 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
Integer amount = amountSet.size(); Integer amount = amountSet.size();
purchaseOrder.setMaterialAmount(amount); purchaseOrder.setMaterialAmount(amount);
return purchaseOrderMapper.insertPurchaseOrder(purchaseOrder); return purchaseOrderMapper.insertPurchaseOrder(purchaseOrder);
}
}
//生成应付账款,根据物料的供应商划分应付供应商,供应商的物料价格合计。
public int purchaseOrderPayment(PurchaseOrder purchaseOrder) {
//获取物料供应商的信息,采购订单的供应商数量
return 0;
}
/** /**
* 修改采购订单 * 修改采购订单
* *
@ -424,6 +436,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
return result; return result;
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ProcessInstance submitApply(PurchaseOrder purchaseOrder) { public ProcessInstance submitApply(PurchaseOrder purchaseOrder) {
@ -516,7 +529,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
private ProcessInstance startProcessInstance(String applyTitle, String instanceType, PurchaseOrder purchaseOrder, SysUser user) { private ProcessInstance startProcessInstance(String applyTitle, String instanceType, PurchaseOrder purchaseOrder, SysUser user) {
Long materialId = purchaseOrder.getPurchaseOrderId(); Long materialId = purchaseOrder.getPurchaseOrderId();
String businessKey = materialId.toString(); // 实体类 ID,作为流程的业务 key String businessKey = materialId.toString(); // 实体类 ID,作为流程的业务 key
String key = "material"; String key = "purchaseOrder";
Map<String,Object> variables = new HashMap<>(); Map<String,Object> variables = new HashMap<>();
// 构造authority传参 // 构造authority传参
buildAuthority(user, variables); buildAuthority(user, variables);

9
ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml

@ -235,14 +235,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where purchase_order_code = #{purchaseOrderCode} group by supplier_code where purchase_order_code = #{purchaseOrderCode} group by supplier_code
</select> </select>
<select id="selectPurhcaseOrderStorageByPurchaseOrderCode" parameterType="String" resultMap="PurchaseOrderChildResult"> <select id="selectPurchaseOrderStorageByPurchaseOrderCode" parameterType="String" resultMap="PurchaseOrderChildResult">
select p.purchase_order_code,p.purchase_plan_code,p.purchase_plan_correlation_code, select p.purchase_order_code,p.purchase_plan_code,p.purchase_plan_correlation_code,
p.supplier_code,p.supplier_name,p.material_code,p.material_name,p.material_type,p.material_describe, p.supplier_code,p.supplier_name,p.material_code,p.material_name,p.material_type,p.material_describe,
p.material_brand,p.material_photoUrl,p.material_process_method,p.material_unit,p.warehouseDept,p.material_no_rmb, p.material_brand,p.material_photoUrl,p.material_process_method,p.material_unit,p.warehouseDept,p.material_no_rmb,
p.material_rmb,p.material_num,p.material_amount,p.material_sum,p.material_no_rmb_sum,p.material_rmb_sum, p.material_rmb,p.material_num,p.material_amount,p.material_sum,p.material_no_rmb_sum,p.material_rmb_sum,
p.material_real_num,p.material_real_no_rmb,p.material_real_rmb,p.material_real_no_rmb_sum,p.material_real_rmb_sum, p.material_real_num,p.material_real_no_rmb,p.material_real_rmb,p.material_real_no_rmb_sum,p.material_real_rmb_sum,
p.delivery_time,p.eceipt_status,p.payment_status,p.tax_rate,p.create_by,p.create_time,p.update_by,p.update_time,p.del_flag,w.has_storage_num,sum(w.notify_arrive_num) as notify_has_arrived_num p.delivery_time,p.eceipt_status,p.payment_status,p.tax_rate,p.create_by,p.create_time,p.update_by,p.update_time,p.del_flag,
from purchase_order_child as p left join warehouse_storage_order_detail as w on p.purchase_order_code = w.related_order_code and p.material_code = w.material_no w.has_storage_num,sum(w.notify_arrive_num) as notify_has_arrived_num
from purchase_order_child as p left join warehouse_storage_order_detail as w
on p.purchase_order_code = w.related_order_code
and p.material_code = w.material_no and p.supplier_code = w.supplier_code
where p.purchase_order_code = #{purchaseOrderCode} GROUP BY supplier_code,material_code where p.purchase_order_code = #{purchaseOrderCode} GROUP BY supplier_code,material_code
</select> </select>
</mapper> </mapper>

21
ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html

@ -122,7 +122,7 @@
{title: '通知已到货数',field: 'notifyHasArrivedNum', {title: '通知已到货数',field: 'notifyHasArrivedNum',
formatter: function (value, row, index) { formatter: function (value, row, index) {
if (value == null || value == '') { if (value == null || value == '') {
return 0; value = 0;
} }
return value; return value;
} }
@ -130,14 +130,22 @@
{title: '已入库数',field: 'hasStorageNum', {title: '已入库数',field: 'hasStorageNum',
formatter: function (value, row, index) { formatter: function (value, row, index) {
if (value == null || value == '') { if (value == null || value == '') {
return 0; value = 0;
} }
return value; return value;
} }
}, },
{title: '通知到货数',field: 'notifyArriveNum', {title: '通知到货数',field: 'notifyArriveNum',editable: {
formatter: function (value, row, index) { type: 'text',
return '<input type="number" min="0" data-id="notifyArriveNum" class="form-control" name="notifyArriveNum" value="'+value+'"'; title: '通知到货数',
validate: function (value, row, index) {
var num = parseInt(value);
if (isNaN(num)) {
return '请输入数字';
} else if (num < 0) {
return '不能小于0';
}
}
} }
} }
] ]
@ -178,8 +186,7 @@
"notifyHasArrivedNum": item.notifyHasArrivedNum, "notifyHasArrivedNum": item.notifyHasArrivedNum,
"hasStorageNum": item.hasStorageNum, //已入库数量 "hasStorageNum": item.hasStorageNum, //已入库数量
"notifyArriveNum": item.notifyArriveNum, //通知到货数量 "notifyArriveNum": item.notifyArriveNum, //通知到货数量
"relatedOrderCode":purchaseOrderCode, "relatedOrderCode":purchaseOrderCode
// ...其他字段
}; };
}); });
allMaterialDataList = allMaterialDataList.concat(materialDataList); allMaterialDataList = allMaterialDataList.concat(materialDataList);

Loading…
Cancel
Save