Compare commits

...

2 Commits

Author SHA1 Message Date
王晓迪 8df6ee6da4 Merge remote-tracking branch 'origin/dev' into dev 4 days ago
王晓迪 17b08aff30 [fix] 4 days ago
  1. 2
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java
  2. 14
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderBomController.java
  3. 18
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeOrder.java
  4. 103
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java

2
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java

@ -491,7 +491,7 @@ public class SysMakeOrderController extends BaseController
makeOrder.setCustomerOderCode(sysSalesOrder.getSalesOrderNumber()); makeOrder.setCustomerOderCode(sysSalesOrder.getSalesOrderNumber());
makeOrder.setMaterial(String.valueOf(sysSalesOrder.getMaterialSum())); makeOrder.setMaterial(String.valueOf(sysSalesOrder.getMaterialSum()));
//这个类型需要注意 //这个类型需要注意
// makeOrder.setMaterialSum(sysSalesOrder.getEnterpriseSum()); makeOrder.setMaterialSum(sysSalesOrder.getEnterpriseSum());
} }
} }
} }

14
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderBomController.java

@ -59,6 +59,20 @@ public class SysMakeorderBomController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/**
* 查询生产订单入库BOM信息列表生产加工类型才需要生产入库
*/
@PostMapping("/storageList")
@ResponseBody
public TableDataInfo storageList(SysMakeorderBom sysMakeorderBom)
{
startPage();
List<SysMakeorderBom> list = sysMakeorderBomService.selectSysMakeorderBomList(sysMakeorderBom);
List<SysMakeorderBom> filterList = list.stream()
.filter(item -> item.getProcessMethod().equals("1")).collect(Collectors.toList());
return getDataTable(filterList);
}
/* /*
* 获取工程审核页面生产bom(去除辅料原料及加工方式为采购*/ * 获取工程审核页面生产bom(去除辅料原料及加工方式为采购*/
@PostMapping("/selectedList") @PostMapping("/selectedList")

18
ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeOrder.java

@ -74,15 +74,15 @@ public class SysMakeOrder extends BaseEntity
/** 数量合计 */ /** 数量合计 */
@Excel(name = "数量合计") @Excel(name = "数量合计")
private Long materialSum; private int materialSum;
/** 已完成数量 */ /** 已完成数量 */
@Excel(name = "已完成数量") @Excel(name = "已完成数量")
private Long finishNum; private int finishNum;
/** 已入库数量 */ /** 已入库数量 */
@Excel(name = "已入库数量") @Excel(name = "已入库数量")
private Long eceiptNum; private int eceiptNum;
/** 不含税生产成本(RMB) */ /** 不含税生产成本(RMB) */
@Excel(name = "不含税生产成本(RMB)") @Excel(name = "不含税生产成本(RMB)")
@ -219,30 +219,30 @@ public class SysMakeOrder extends BaseEntity
{ {
return material; return material;
} }
public void setMaterialSum(Long materialSum) public void setMaterialSum(int materialSum)
{ {
this.materialSum = materialSum; this.materialSum = materialSum;
} }
public Long getMaterialSum() public int getMaterialSum()
{ {
return materialSum; return materialSum;
} }
public void setFinishNum(Long finishNum) public void setFinishNum(int finishNum)
{ {
this.finishNum = finishNum; this.finishNum = finishNum;
} }
public Long getFinishNum() public int getFinishNum()
{ {
return finishNum; return finishNum;
} }
public void setEceiptNum(Long eceiptNum) public void setEceiptNum(int eceiptNum)
{ {
this.eceiptNum = eceiptNum; this.eceiptNum = eceiptNum;
} }
public Long getEceiptNum() public int getEceiptNum()
{ {
return eceiptNum; return eceiptNum;
} }

103
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java

@ -19,9 +19,11 @@ import com.ruoyi.purchase.service.IPurchasePlanService;
import com.ruoyi.quality.domain.QualityOrder; import com.ruoyi.quality.domain.QualityOrder;
import com.ruoyi.quality.domain.QualityOrderDetail; import com.ruoyi.quality.domain.QualityOrderDetail;
import com.ruoyi.quality.domain.QualityOrderReport; import com.ruoyi.quality.domain.QualityOrderReport;
import com.ruoyi.quality.domain.QualityShippingDevice;
import com.ruoyi.quality.mapper.QualityOrderDetailMapper; import com.ruoyi.quality.mapper.QualityOrderDetailMapper;
import com.ruoyi.quality.mapper.QualityOrderMapper; import com.ruoyi.quality.mapper.QualityOrderMapper;
import com.ruoyi.quality.mapper.QualityOrderReportMapper; import com.ruoyi.quality.mapper.QualityOrderReportMapper;
import com.ruoyi.quality.mapper.QualityShippingDeviceMapper;
import com.ruoyi.system.domain.*; import com.ruoyi.system.domain.*;
import com.ruoyi.system.dto.SysEquipDetailDto; import com.ruoyi.system.dto.SysEquipDetailDto;
import com.ruoyi.system.dto.SysEquipMaterialDto; import com.ruoyi.system.dto.SysEquipMaterialDto;
@ -107,6 +109,9 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService
@Autowired @Autowired
private ErpMaterialMapper erpMaterialMapper; private ErpMaterialMapper erpMaterialMapper;
@Autowired
private QualityShippingDeviceMapper qualityDeviceMapper;
/** /**
* 查询生产订单 * 查询生产订单
* *
@ -259,7 +264,7 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService
makeOrder.setCustomerName(sysSalesOrderVo.getEnterpriseName()); makeOrder.setCustomerName(sysSalesOrderVo.getEnterpriseName());
makeOrder.setCustomerOderCode(sysSalesOrderVo.getSalesOrderNumber()); makeOrder.setCustomerOderCode(sysSalesOrderVo.getSalesOrderNumber());
//这里需要注意一下类型 //这里需要注意一下类型
//makeOrder.setMaterialSum(sysSalesOrderVo.getEnterpriseSum()); makeOrder.setMaterialSum(sysSalesOrderVo.getEnterpriseSum());
makeOrder.setMaterial(String.valueOf(sysSalesOrderVo.getMaterialSum())); makeOrder.setMaterial(String.valueOf(sysSalesOrderVo.getMaterialSum()));
String makeNo = redisCache.generateBillNo("PO"); String makeNo = redisCache.generateBillNo("PO");
makeOrder.setMakeNo(makeNo); makeOrder.setMakeNo(makeNo);
@ -589,6 +594,7 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService
@Override @Override
public int addProduceInboundSave(ErpInboundOrder erpInboundOrder) { public int addProduceInboundSave(ErpInboundOrder erpInboundOrder) {
String loginName = ShiroUtils.getLoginName(); String loginName = ShiroUtils.getLoginName();
String makeNo = erpInboundOrder.getMakeNo();
erpInboundOrder.setCreateBy(loginName); erpInboundOrder.setCreateBy(loginName);
erpInboundOrder.setCreateTime(DateUtils.getNowDate()); erpInboundOrder.setCreateTime(DateUtils.getNowDate());
List<ErpInboundOrderDetail> inboundDetails = erpInboundOrder.getInboundDetails(); List<ErpInboundOrderDetail> inboundDetails = erpInboundOrder.getInboundDetails();
@ -601,36 +607,91 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService
throw new BusinessException("本次完成数不能全为0"); throw new BusinessException("本次完成数不能全为0");
} }
for (ErpInboundOrderDetail inboundDetail:inboundDetails) { for (ErpInboundOrderDetail inboundDetail:inboundDetails) {
//获取物料信息
String materialNo = inboundDetail.getMaterialNo();
SysMakeorderBom tempOrderBom = new SysMakeorderBom();
tempOrderBom.setMaterialNo(materialNo);
tempOrderBom.setMakeNo(makeNo);
SysMakeorderBom makeorderBom = makeorderBomMapper.selectSysMakeorderBomByNo(tempOrderBom);
//生成并新增品质单
String qualityOrderCode = redisCache.generateBillNo("PZ"); String qualityOrderCode = redisCache.generateBillNo("PZ");
QualityOrder qualityOrder = createQualityOrder(qualityOrderCode, erpInboundOrder, loginName);
int orderDetailResult = generateQualityOrderDetail(qualityOrderCode,makeorderBom,inboundDetail.getCurrentNum());
if(orderDetailResult<=0){
throw new BusinessException("新增品质单详情失败!");
}
QualityOrder qualityOrder = createQualityOrder(qualityOrderCode, erpInboundOrder.getMakeNo(), loginName);
qualityOrder.setMaterialNo(makeorderBom.getMaterialNo());
qualityOrder.setMaterialName(makeorderBom.getMaterialName());
qualityOrder.setThisArrivedNum(inboundDetail.getCurrentNum());
result += qualityOrderMapper.insertQualityOrder(qualityOrder); result += qualityOrderMapper.insertQualityOrder(qualityOrder);
//根据出货设备生成品质单关联出货设备,并更新出货设备品质状态
List<AfterSalesShippingDevice> deviceList = inboundDetail.getSalesShippingDeviceList(); List<AfterSalesShippingDevice> deviceList = inboundDetail.getSalesShippingDeviceList();
if(StringUtils.isNotEmpty(deviceList)){ if(StringUtils.isNotEmpty(deviceList)){
for (AfterSalesShippingDevice device:deviceList) { for (AfterSalesShippingDevice device:deviceList) {
QualityShippingDevice qualityDevice = generateQualityShippingDevice(qualityOrderCode,device);
int insertDeviceResult = qualityDeviceMapper.insertQualityShippingDevice(qualityDevice);
if(insertDeviceResult<=0){
throw new BusinessException("添加品质单关联设备"+qualityDevice.getShippingDeviceId()+"失败");
}
device.setQualityStatus("1");//待品质 device.setQualityStatus("1");//待品质
afterSalesShippingDeviceMapper.updateAfterSalesShippingDevice(device); afterSalesShippingDeviceMapper.updateAfterSalesShippingDevice(device);
} }
} }
} }
//品质报告单审核通过后再更新已完成数
// SysMakeOrder sysMakeOrder = sysMakeOrderMapper.selectMakeOrderByMakeNo(erpInboundOrder.getMakeNo());
// long hasFinished = sysMakeOrder.getFinishNum();
// finishNum += hasFinished;
// sysMakeOrder.setFinishNum(finishNum);
// int updateSysMakeOrderResult = sysMakeOrderMapper.updateSysMakeOrder(sysMakeOrder);
// if (updateSysMakeOrderResult <= 0){
// throw new BusinessException("更新生产订单失败");
// }
return result; return result;
} }
private QualityOrder createQualityOrder(String code, ErpInboundOrder erpInboundOrder, String loginName) { //根据售后出货设备生成品质单关联设备
private QualityShippingDevice generateQualityShippingDevice(String qualityOrderCode,AfterSalesShippingDevice shippingDevice){
QualityShippingDevice qualityDevice = new QualityShippingDevice();
qualityDevice.setShippingDeviceId(shippingDevice.getShippingDeviceId());
qualityDevice.setMakeNo(shippingDevice.getMakeNo());
qualityDevice.setQualityAuditStatus("0");
qualityDevice.setQualityStatus("0");
qualityDevice.setDeviceModelCode(shippingDevice.getDeviceModelCode());
qualityDevice.setDeviceRunningNumber(shippingDevice.getDeviceRunningNumber());
qualityDevice.setSalesOrderCode(shippingDevice.getSalesOrderCode());
qualityDevice.setMaterialNo(shippingDevice.getMaterialNo());
qualityDevice.setMaterialName(shippingDevice.getMaterialName());
qualityDevice.setMaterialType(shippingDevice.getMaterialType());
qualityDevice.setMaterialBrand(shippingDevice.getMaterialBrand());
qualityDevice.setMaterialUnit(shippingDevice.getMaterialUnit());
qualityDevice.setMaterialDescribe(shippingDevice.getMaterialDescribe());
qualityDevice.setQualityOrderCode(qualityOrderCode);
return qualityDevice;
}
//根据生产订单bom生成品质单详情
private int generateQualityOrderDetail(String qualityOrderCode,SysMakeorderBom makeorderBom,int checkNum){
QualityOrderDetail qualityOrderDetail = new QualityOrderDetail();
qualityOrderDetail.setQualityOrderCode(qualityOrderCode);
qualityOrderDetail.setMaterialNo(makeorderBom.getMaterialNo());
qualityOrderDetail.setMaterialName(makeorderBom.getMaterialName());
qualityOrderDetail.setMaterialType(makeorderBom.getMaterialType());
qualityOrderDetail.setMaterialBrand(makeorderBom.getBrand());
qualityOrderDetail.setMaterialUnit(makeorderBom.getUnit());
qualityOrderDetail.setMaterialPhotourl(makeorderBom.getPhotoUrl());
qualityOrderDetail.setMaterialDescribe(makeorderBom.getDescribe());
qualityOrderDetail.setMaterialModel(makeorderBom.getMaterialModel());
qualityOrderDetail.setMaterialProcessMethod(makeorderBom.getProcessMethod());
qualityOrderDetail.setCheckNum(checkNum);
qualityOrderDetail.setMakeTotal(makeorderBom.getOrderNum());
qualityOrderDetail.setQualityStatus("0");
qualityOrderDetail.setQualityStorageStatus("4");
qualityOrderDetail.setQualityOrderType("1");
qualityOrderDetail.setRelatedOrderCode(makeorderBom.getMakeNo());
qualityOrderDetail.setCreateBy(ShiroUtils.getLoginName());
qualityOrderDetail.setCreateTime(DateUtils.getNowDate());
return orderDetailMapper.insertQualityOrderDetail(qualityOrderDetail);
}
private QualityOrder createQualityOrder(String code, String makeNo, String loginName) {
QualityOrder qualityOrder = new QualityOrder(); QualityOrder qualityOrder = new QualityOrder();
qualityOrder.setQualityOrderCode(code); qualityOrder.setQualityOrderCode(code);
qualityOrder.setRelatedOrderCode(erpInboundOrder.getMakeNo()); qualityOrder.setRelatedOrderCode(makeNo);
qualityOrder.setQualityStatus("0"); qualityOrder.setQualityStatus("0");
qualityOrder.setQualityStorageStatus("4"); qualityOrder.setQualityStorageStatus("4");
qualityOrder.setQualityOrderType("1"); qualityOrder.setQualityOrderType("1");
@ -682,20 +743,6 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService
return qualityOrderDetail; return qualityOrderDetail;
} }
//添加品质单报告数据
private void addQualityOrderReports(QualityOrder qualityOrder, ErpInboundOrder erpInboundOrder, Map<String, SysSalesOrderChild> materialInfoMap) {
for (ErpInboundOrderDetail detail : erpInboundOrder.getInboundDetails()) {
SysSalesOrderChild salesOrderChild = materialInfoMap.get(detail.getMaterialNo());
QualityOrderReport qualityOrderReport = createQualityOrderReport(qualityOrder, detail, salesOrderChild);
int result = orderReportMapper.insertQualityOrderReport(qualityOrderReport);
if (result <= 0) {
throw new BusinessException("新增品质单报告失败");
}
}
}
private QualityOrderReport createQualityOrderReport(QualityOrder qualityOrder, ErpInboundOrderDetail detail, SysSalesOrderChild salesOrderChild) { private QualityOrderReport createQualityOrderReport(QualityOrder qualityOrder, ErpInboundOrderDetail detail, SysSalesOrderChild salesOrderChild) {
QualityOrderReport qualityOrderReport = new QualityOrderReport(); QualityOrderReport qualityOrderReport = new QualityOrderReport();

Loading…
Cancel
Save