Browse Source

[feat]:根据销售订单编号生成生产订单

dev
youjianchi 8 months ago
parent
commit
a4efd14339
  1. 6
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeOrderService.java
  2. 12
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeorderDeptService.java
  3. 40
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java
  4. 12
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderDeptServiceImpl.java

6
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeOrderService.java

@ -85,4 +85,10 @@ public interface ISysMakeOrderService
* 生产订单完成的订单
*/
public Integer selectSysMakeOrderByFinsh();
/**
* 根据销售订单编号生成生产订单
* @param salesOrderCode
*/
void generateMakeOrderBySalesOrderCode(String salesOrderCode);
}

12
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeorderDeptService.java

@ -1,5 +1,6 @@
package com.ruoyi.system.service;
import java.util.Arrays;
import java.util.List;
import com.ruoyi.system.domain.SysMakeorderDept;
@ -11,6 +12,10 @@ import com.ruoyi.system.domain.SysMakeorderDept;
*/
public interface ISysMakeorderDeptService
{
// 预审部门 业务部、工程部、采购部、品质部(来料、生产)、生产部
List<String> YS_DEPT_NUMBER_LIST = Arrays.asList("GMD","END","PUD","QAD","PD");
/**
* 查询生产订单部门
*
@ -84,4 +89,11 @@ public interface ISysMakeorderDeptService
* @param makeorderDeptList
*/
void deptLeaderConfirm(List<SysMakeorderDept> makeorderDeptList);
/**
* 根据生产订单号料号生成预审数据
* @param makeNo
* @param materialNo
*/
void generateYsDataByMakeNoAndMaterialNo(String makeNo,String materialNo);
}

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

@ -1,12 +1,16 @@
package com.ruoyi.system.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.system.domain.SysMakeOrder;
import com.ruoyi.system.domain.SysSalesOrderChild;
import com.ruoyi.system.mapper.SysMakeOrderMapper;
import com.ruoyi.system.service.ISysMakeOrderService;
import com.ruoyi.system.service.ISysMakeorderDeptService;
import com.ruoyi.system.service.ISysSalesOrderChildService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -19,7 +23,7 @@ import java.util.List;
* @date 2023-12-18
*/
@Service
public class SysMakeOrderServiceImpl implements ISysMakeOrderService
public class SysMakeOrderServiceImpl implements ISysMakeOrderService
{
@Autowired
private SysMakeOrderMapper sysMakeOrderMapper;
@ -27,6 +31,12 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService
@Autowired
private RedisCache redisCache;
@Autowired
private ISysMakeorderDeptService makeorderDeptService;
@Autowired
private ISysSalesOrderChildService salesOrderChildService;
/**
* 查询生产订单
*
@ -63,12 +73,6 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService
String loginName = ShiroUtils.getLoginName();
sysMakeOrder.setCreateBy(loginName);
sysMakeOrder.setCreateTime(DateUtils.getNowDate());
String makeNo = redisCache.generateBillNo("PO");
sysMakeOrder.setMakeNo(makeNo);
sysMakeOrder.setUseStatus("0");
sysMakeOrder.setMakeStatus("0");
sysMakeOrder.setEceiptStatus("0");
sysMakeOrder.setQualityStatus("0");
return sysMakeOrderMapper.insertSysMakeOrder(sysMakeOrder);
}
@ -160,4 +164,26 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService
public Integer selectSysMakeOrderByFinsh() {
return sysMakeOrderMapper.selectSysMakeOrderByFinsh();
}
@Override
public void generateMakeOrderBySalesOrderCode(String salesOrderCode) {
SysMakeOrder makeOrder = new SysMakeOrder();
// 待评审
makeOrder.setMakeStatus("1");
// 是
makeOrder.setUseStatus("1");
makeOrder.setSaleNo(salesOrderCode);
String makeNo = redisCache.generateBillNo("PO");
makeOrder.setMakeNo(makeNo);
insertSysMakeOrder(makeOrder);
// 生成部门待预审数据
List<SysSalesOrderChild> salesOrderChildList = salesOrderChildService.selectSysSalesOrderChildByQuoteId(salesOrderCode);
if(CollectionUtil.isNotEmpty(salesOrderChildList)){
salesOrderChildList.forEach(t->{
String materialCode = t.getMaterialCode();
makeorderDeptService.generateYsDataByMakeNoAndMaterialNo(makeNo,materialCode);
});
}
}
}

12
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderDeptServiceImpl.java

@ -187,4 +187,16 @@ public class SysMakeorderDeptServiceImpl implements ISysMakeorderDeptService
sysMakeorderDeptMapper.updateSysMakeorderDept(dept);
});
}
@Override
public void generateYsDataByMakeNoAndMaterialNo(String makeNo, String materialNo) {
for (int i = 0; i < YS_DEPT_NUMBER_LIST.size(); i++) {
String ysDeptNumber = YS_DEPT_NUMBER_LIST.get(i);
SysMakeorderDept makeorderDept = new SysMakeorderDept();
makeorderDept.setMakeNo(makeNo);
makeorderDept.setMaterialNo(materialNo);
makeorderDept.setDeptNumber(ysDeptNumber);
insertSysMakeorderDept(makeorderDept);
}
}
}

Loading…
Cancel
Save