组装任务生成待执行入库任务
This commit is contained in:
parent
e936e8e613
commit
614299992d
@ -30,41 +30,6 @@
|
||||
<artifactId>springfox-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 测试 -->
|
||||
<!-- 测试所需 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!--去除内嵌tomcat-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-websocket -->
|
||||
<!--websocket依赖包-->
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-websocket</artifactId>
|
||||
<version>8.5.23</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.websocket</groupId>
|
||||
<artifactId>javax.websocket-api</artifactId>
|
||||
<version>1.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 -->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
@ -72,7 +37,7 @@
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql驱动包 -->
|
||||
<!-- Mysql驱动包 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
@ -103,43 +68,20 @@
|
||||
</dependency>
|
||||
|
||||
<!-- 达梦数据库驱动依赖 -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.dameng</groupId>-->
|
||||
<!-- <artifactId>DmJdbcDriver18</artifactId>-->
|
||||
<!-- <version>8.1.2.79</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.dameng</groupId>-->
|
||||
<!-- <artifactId>DmDialect-for-hibernate5.4</artifactId>-->
|
||||
<!-- <version>8.1.3.140</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.dm</groupId>-->
|
||||
<!-- <artifactId>DmJdbcDriver</artifactId>-->
|
||||
<!-- <version>1.8</version>-->
|
||||
<!-- <scope>system</scope>-->
|
||||
<!-- <systemPath>${basedir}/lib/DmJdbcDriver18.jar</systemPath>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.dm.dialect</groupId>-->
|
||||
<!-- <artifactId>hibernate5</artifactId>-->
|
||||
<!-- <version>5.4</version>-->
|
||||
<!-- <scope>system</scope>-->
|
||||
<!-- <systemPath>${basedir}/lib/DmDialect-for-hibernate5.4.jar</systemPath>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.dm</groupId>
|
||||
<artifactId>DmJdbcDriver</artifactId>
|
||||
<version>1.8</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/DmJdbcDriver18.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.dm.dialect</groupId>
|
||||
<artifactId>hibernate5</artifactId>
|
||||
<version>5.4</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/DmDialect-for-hibernate5.4.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@ -167,7 +109,7 @@
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<warName>${project.artifactId}</warName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</build>
|
||||
|
@ -7,8 +7,8 @@ spring:
|
||||
# 主库数据源
|
||||
master:
|
||||
# url: jdbc:dm://30.30.2.24:5237/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# url: jdbc:dm://localhost:5236/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:dm://192.168.8.60:5236/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:dm://localhost:5236/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# url: jdbc:dm://192.168.8.60:5236/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: SYSDBA
|
||||
password: SYSDBA
|
||||
# 从库数据源
|
||||
|
@ -63,13 +63,15 @@ spring:
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 192.168.8.60
|
||||
# host: 192.168.8.60
|
||||
host: 127.0.0.1
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 4
|
||||
# 密码
|
||||
password: 123456
|
||||
# password: 123456
|
||||
password:
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
|
@ -42,7 +42,7 @@ public class WmsInPlanTest {
|
||||
public void insertWmsInPlan() {
|
||||
WmsInPlan wmsInPlan = new WmsInPlan();
|
||||
wmsInPlan.setState("0");
|
||||
wmsInPlan.setSourceType("ZDSC");
|
||||
wmsInPlan.setSourceType("SCZB");
|
||||
wmsInPlan.setWareId("10");
|
||||
wmsInPlan.setCellCode("A0089");
|
||||
wmsInPlan.setRelBillCode("123456");
|
||||
@ -60,7 +60,7 @@ public class WmsInPlanTest {
|
||||
WmsInPlan wmsInPlan = new WmsInPlan();
|
||||
wmsInPlan.setPlanId("41");
|
||||
wmsInPlan.setState("0");
|
||||
wmsInPlan.setSourceType("ZDSC");
|
||||
wmsInPlan.setSourceType("SCZB");
|
||||
wmsInPlan.setWareId("10");
|
||||
wmsInPlan.setCellCode("A0089");
|
||||
wmsInPlan.setRelBillCode("123456");
|
||||
|
@ -24,7 +24,7 @@ public class WmsOutPlanTest {
|
||||
WmsOutPlan wmsOutPlan = new WmsOutPlan();
|
||||
wmsOutPlan.setPlanCode("CKJH202411020949");
|
||||
wmsOutPlan.setWmsBusinessTypeId(12L);
|
||||
wmsOutPlan.setPlanType("ZDSC");
|
||||
wmsOutPlan.setPlanType("SCZB");
|
||||
wmsOutPlan.setPlanState("1");
|
||||
int i = wmsOutPlanService.insertWmsOutPlan(wmsOutPlan);
|
||||
System.out.println(i);
|
||||
@ -39,7 +39,7 @@ public class WmsOutPlanTest {
|
||||
wmsOutPlan.setWmsOutPlanId(27L);
|
||||
wmsOutPlan.setPlanCode("CKJH202411020949");
|
||||
wmsOutPlan.setWmsBusinessTypeId(12L);
|
||||
wmsOutPlan.setPlanType("ZDSC");
|
||||
wmsOutPlan.setPlanType("SCZB");
|
||||
wmsOutPlan.setPlanState("0");
|
||||
int i = wmsOutPlanService.updateWmsOutPlan(wmsOutPlan);
|
||||
System.out.println(i);
|
||||
|
@ -901,7 +901,7 @@ public class BaseKnifeController extends BaseController {
|
||||
if (wmsInPlan == null) {
|
||||
WmsInPlan wmsInPlanTemp = new WmsInPlan();
|
||||
wmsInPlanTemp.setState("1");
|
||||
wmsInPlanTemp.setSourceType("ZDSC");
|
||||
wmsInPlanTemp.setSourceType("SCZB");
|
||||
wmsInPlanTemp.setCellCode(zdTask.getAttr3());
|
||||
wmsInPlanTemp.setPlanCode(zdTask.getAttr4() == null ? zdTask.getCode() : zdTask.getAttr4());
|
||||
wmsInPlanTemp.setRelBillCode("组装单据");
|
||||
|
@ -40,6 +40,17 @@ public class WmsOutTaskController extends BaseController {
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 开放 查询出库任务列表
|
||||
*/
|
||||
@GetMapping("/open/incomplete/{planSheet}")
|
||||
public TableDataInfo openList(@PathVariable String planSheet) {
|
||||
startPage();
|
||||
List<WmsOutTask> list = wmsOutTaskService.selectWmsOutTaskIncompleteList(planSheet);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询出库任务列表
|
||||
*/
|
||||
|
@ -293,7 +293,7 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
|
||||
wmsOutPlan.setPlanCode(Long.toString(System.currentTimeMillis(), 32).toUpperCase(Locale.ROOT));
|
||||
wmsOutPlan.setWmsBusinessTypeId(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId() != null ? Long.parseLong(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId()) : 14L);
|
||||
wmsOutPlan.setPlanState("1");
|
||||
wmsOutPlan.setPlanType("ZDSC");
|
||||
wmsOutPlan.setPlanType("SCZB");
|
||||
wmsOutPlan.setRemark("一键清退无寿命物品");
|
||||
wmsOutPlan.setCreateBy(username);
|
||||
wmsOutPlan.setCreateTime(new Date());
|
||||
|
@ -5,27 +5,25 @@ import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.common.utils.DateUtils;
|
||||
import com.ktg.common.utils.StringUtils;
|
||||
import com.ktg.common.utils.poi.ExcelUtil;
|
||||
import com.ktg.mes.md.domain.BaseKnife;
|
||||
import com.ktg.mes.md.domain.MdItem;
|
||||
import com.ktg.mes.md.domain.*;
|
||||
import com.ktg.mes.md.service.IBaseKnifeService;
|
||||
import com.ktg.mes.md.service.IMdItemService;
|
||||
import com.ktg.mes.wm.domain.WmStorageArea;
|
||||
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
|
||||
import com.ktg.mes.wm.domain.WmsInTask;
|
||||
import com.ktg.mes.wm.service.IWmStorageAreaService;
|
||||
import com.ktg.mes.wm.service.IWmsInPlanDetailEntityService;
|
||||
import com.ktg.mes.wm.service.IWmsInTaskService;
|
||||
import com.ktg.mes.wm.domain.*;
|
||||
import com.ktg.mes.wm.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import static com.ktg.generator.util.MultiModuleCodeGenerator.generateTaskCode;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
import com.ktg.mes.wm.mapper.*;
|
||||
import com.ktg.mes.md.mapper.*;
|
||||
|
||||
/**
|
||||
* 入库任务Controller
|
||||
@ -39,6 +37,10 @@ public class WmsInTaskController extends BaseController {
|
||||
@Autowired
|
||||
private IWmsInTaskService wmsInTaskService;
|
||||
@Autowired
|
||||
private IWmsInPlanService wmsInPlanService;
|
||||
@Autowired
|
||||
private IWmsZdTaskService wmsZdTaskService;
|
||||
@Autowired
|
||||
private IMdItemService mdItemService;
|
||||
@Autowired
|
||||
private IBaseKnifeService baseKnifeService;
|
||||
@ -47,6 +49,36 @@ public class WmsInTaskController extends BaseController {
|
||||
@Autowired
|
||||
private IWmsInPlanDetailEntityService wmsInPlanDetailEntityService;
|
||||
|
||||
@Autowired
|
||||
private WmsOutPlanMapper wmsOutPlanMapper;
|
||||
|
||||
@Autowired
|
||||
private WmsOutPlanDetailEntityMapper wmsOutPlanDetailEntityMapper;
|
||||
|
||||
@Autowired
|
||||
private WmsOutTaskMapper wmsOutTaskMapper;
|
||||
|
||||
@Autowired
|
||||
private ProductionArrangementsMapper productionArrangementsMapper;
|
||||
|
||||
@Autowired
|
||||
private BaseKnifeMapper baseKnifeMapper;
|
||||
|
||||
@Autowired
|
||||
private BomRouteMapper bomRouteMapper;
|
||||
|
||||
@Autowired
|
||||
private MdItemMapper mdItemMapper;
|
||||
|
||||
@Autowired
|
||||
private BaseTechnologyBomMapper baseTechnologyBomMapper;
|
||||
|
||||
@Autowired
|
||||
private WmsZdTaskMapper wmsZdTaskMapper;
|
||||
|
||||
@Autowired
|
||||
private WmStorageAreaMapper wmStorageAreaMapper;
|
||||
|
||||
/**
|
||||
* 查询入库任务列表
|
||||
*/
|
||||
@ -126,6 +158,7 @@ public class WmsInTaskController extends BaseController {
|
||||
// @Log(title = "入库任务", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/open/issueBatch/{ids}")
|
||||
@ResponseBody
|
||||
@Transactional
|
||||
public AjaxResult issueBatch(@PathVariable String[] ids) {
|
||||
for (String taskId : ids) {
|
||||
// 获取任务信息
|
||||
@ -142,8 +175,53 @@ public class WmsInTaskController extends BaseController {
|
||||
wmsInPlanDetailEntity.setPlanDetailsId(wmsInTask.getDetailInId());
|
||||
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetailEntityService.selectWmsInPlanDetailEntityList(wmsInPlanDetailEntity);
|
||||
|
||||
// 入库类型为整刀回库
|
||||
if (Objects.equals(wmsInTask.getPlanTypeId(), "9")) {
|
||||
// 如果是自动生成的组刀任务入库
|
||||
WmsInPlan wmsInPlan = wmsInPlanService.selectWmsInPlanByPlanId(wmsInTask.getPlanInId());
|
||||
if (Objects.equals("SCZB", wmsInPlan.getSourceType())){
|
||||
// 查询组装任务
|
||||
WmsZdTask wmsZdTaskWrapper = new WmsZdTask();
|
||||
wmsZdTaskWrapper.setPlanSheet(wmsInPlan.getPlanCode());
|
||||
wmsZdTaskWrapper.setmProductId(Long.parseLong(wmsInTask.getMaterialId()));
|
||||
List<WmsZdTask> zdTaskList = wmsZdTaskService.selectWmsZdTaskList(wmsZdTaskWrapper);
|
||||
if (zdTaskList.size() != 1) return AjaxResult.error("组刀任务不存在");
|
||||
|
||||
// 获取台账信息
|
||||
BaseKnife baseKnifeWrapper = new BaseKnife();
|
||||
baseKnifeWrapper.setZdTaskId(zdTaskList.get(0).getWmsZdTaskId());
|
||||
baseKnifeWrapper.setMbbBdMrlId(zdTaskList.get(0).getmProductId());
|
||||
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeNotValidList(baseKnifeWrapper);
|
||||
|
||||
// 整 刀台账设为有效
|
||||
baseKnifeList.forEach(baseKnife -> {
|
||||
baseKnife.setIsValid(0);
|
||||
baseKnife.setCreateTime(DateUtils.getNowDate());
|
||||
baseKnifeService.updateBaseKnife(baseKnife);
|
||||
});
|
||||
|
||||
// 检测订单是否完成,完成则出库整刀
|
||||
if (this.checkFinal(wmsInPlan.getPlanCode())) this.createOutTask(wmsInPlan.getPlanCode());
|
||||
} else if (Objects.equals("ZZRW", wmsInPlan.getSourceType())){
|
||||
// 查询组装任务
|
||||
WmsZdTask wmsZdTaskWrapper = new WmsZdTask();
|
||||
wmsZdTaskWrapper.setCode(wmsInPlan.getPlanCode());
|
||||
wmsZdTaskWrapper.setmProductId(Long.parseLong(wmsInTask.getMaterialId()));
|
||||
List<WmsZdTask> zdTaskList = wmsZdTaskService.selectWmsZdTaskList(wmsZdTaskWrapper);
|
||||
if (zdTaskList.size() != 1) return AjaxResult.error("组刀任务不存在");
|
||||
|
||||
// 获取台账信息
|
||||
BaseKnife baseKnifeWrapper = new BaseKnife();
|
||||
baseKnifeWrapper.setZdTaskId(zdTaskList.get(0).getWmsZdTaskId());
|
||||
baseKnifeWrapper.setMbbBdMrlId(zdTaskList.get(0).getmProductId());
|
||||
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeNotValidList(baseKnifeWrapper);
|
||||
|
||||
// 整 刀台账设为有效
|
||||
baseKnifeList.forEach(baseKnife -> {
|
||||
baseKnife.setIsValid(0);
|
||||
baseKnife.setCreateTime(DateUtils.getNowDate());
|
||||
baseKnifeService.updateBaseKnife(baseKnife);
|
||||
});
|
||||
} else if (Objects.equals(wmsInTask.getPlanTypeId(), "9")) {
|
||||
// 入库类型为整刀回库
|
||||
wmsInPlanDetailEntityList.forEach(planDetailEntity -> {
|
||||
BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(planDetailEntity.getKnifeId());
|
||||
// 计算消耗寿命
|
||||
@ -232,4 +310,144 @@ public class WmsInTaskController extends BaseController {
|
||||
}
|
||||
return toAjax(1);
|
||||
}
|
||||
|
||||
|
||||
// 检查订单完成状态
|
||||
public Boolean checkFinal(String planSheet){
|
||||
// 获取订单记录
|
||||
ProductionArrangements productionArrangements = productionArrangementsMapper.selectProductionArrangementsByPlanSheet(planSheet);
|
||||
BaseTechnologyBom baseTechnologyBomWrapper = new BaseTechnologyBom();
|
||||
baseTechnologyBomWrapper.setTechnologyCode(productionArrangements.getTechnologyCode());
|
||||
List<BaseTechnologyBom> baseTechnologyBomList = baseTechnologyBomMapper.selectBaseTechnologyBomList(baseTechnologyBomWrapper);
|
||||
|
||||
// 判断订单锁定的物料是否足够
|
||||
for (BaseTechnologyBom technologyBom : baseTechnologyBomList) {
|
||||
BaseKnife baseKnifeWrapper = new BaseKnife();
|
||||
baseKnifeWrapper.setPlanSheet(planSheet);
|
||||
baseKnifeWrapper.setKnifeCode(technologyBom.getKnifeCode());
|
||||
List<BaseKnife> baseKnifePlanSheetList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper);
|
||||
if (baseKnifePlanSheetList.size() < technologyBom.getKnifeCount()) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// 检查订单完成状态
|
||||
@Transactional
|
||||
public void createOutTask(String planSheet){
|
||||
// 构建出库计划
|
||||
WmsOutPlan outPlan = new WmsOutPlan();
|
||||
outPlan.setPlanCode(planSheet);
|
||||
outPlan.setWmsBusinessTypeId(16L);
|
||||
outPlan.setPlanState("1");
|
||||
outPlan.setPlanType("ZDCK");
|
||||
outPlan.setCreateBy(getUsername());
|
||||
outPlan.setCreateTime(DateUtils.getNowDate());
|
||||
wmsOutPlanMapper.insertWmsOutPlan(outPlan);
|
||||
|
||||
// 所有的物料
|
||||
List<BaseKnife> baseKnifeResultList = new ArrayList<>();
|
||||
|
||||
// 获取订单记录
|
||||
ProductionArrangements productionArrangements = productionArrangementsMapper.selectProductionArrangementsByPlanSheet(planSheet);
|
||||
BaseTechnologyBom baseTechnologyBomWrapper = new BaseTechnologyBom();
|
||||
baseTechnologyBomWrapper.setTechnologyCode(productionArrangements.getTechnologyCode());
|
||||
List<BaseTechnologyBom> baseTechnologyBomList = baseTechnologyBomMapper.selectBaseTechnologyBomList(baseTechnologyBomWrapper);
|
||||
|
||||
// 判断订单锁定的物料是否足够
|
||||
for (BaseTechnologyBom technologyBom : baseTechnologyBomList) {
|
||||
BaseKnife baseKnifeWrapper = new BaseKnife();
|
||||
baseKnifeWrapper.setPlanSheet(planSheet);
|
||||
baseKnifeWrapper.setKnifeCode(technologyBom.getKnifeCode());
|
||||
List<BaseKnife> baseKnifeLockedList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper);
|
||||
if (baseKnifeLockedList.size() == technologyBom.getKnifeCount()) baseKnifeResultList.addAll(baseKnifeLockedList);
|
||||
}
|
||||
|
||||
String batchNum = "SCZBPC01";
|
||||
// 出库任务,进行整刀的出库
|
||||
HashMap<Long, HashMap<String, List<BaseKnife>>> baseKnifeHashMapMap = new HashMap<>();
|
||||
|
||||
// 遍历构建map
|
||||
baseKnifeResultList.forEach(item -> {
|
||||
// 判断当前物料主键是否已经被收录
|
||||
baseKnifeHashMapMap.computeIfAbsent(item.getMbbBdMrlId(), k -> new HashMap<>());
|
||||
|
||||
// 判断当前库位编码是否已经被收录
|
||||
baseKnifeHashMapMap.get(item.getMbbBdMrlId()).computeIfAbsent(item.getAreaCode(), k -> new ArrayList<>());
|
||||
|
||||
// 对当前台账对象进行收录
|
||||
baseKnifeHashMapMap.get(item.getMbbBdMrlId()).get(item.getAreaCode()).add(item);
|
||||
});
|
||||
|
||||
// 生成出库计划明细
|
||||
WmsOutPlan outPlanTemp = outPlan;
|
||||
baseKnifeHashMapMap.keySet().forEach(mdItemId -> {
|
||||
MdItem mdItemOutPlan = mdItemMapper.selectMdItemById(mdItemId);
|
||||
// 根据库位编码遍历
|
||||
baseKnifeHashMapMap.get(mdItemId).keySet().forEach(areaCode -> {
|
||||
// 获得库位对象
|
||||
WmStorageArea wmStorageAreaOutPlan = wmStorageAreaMapper.selectWmStorageAreaByAreaCode(areaCode);
|
||||
|
||||
WmsOutPlanDetail outPlanDetail = new WmsOutPlanDetail();
|
||||
outPlanDetail.setWmsOutPlanId(outPlanTemp.getWmsOutPlanId());
|
||||
outPlanDetail.setMdItemId(mdItemId);
|
||||
outPlanDetail.setMdItemCode(mdItemOutPlan.getItemCode());
|
||||
outPlanDetail.setMdItemName(mdItemOutPlan.getItemName());
|
||||
outPlanDetail.setMdItemUnit(mdItemOutPlan.getUnitName());
|
||||
outPlanDetail.setPlannedQuantity(baseKnifeHashMapMap.get(mdItemId).get(areaCode).size());
|
||||
outPlanDetail.setRealQuantity(baseKnifeHashMapMap.get(mdItemId).get(areaCode).size());
|
||||
outPlanDetail.setDetailBatchNum(batchNum);
|
||||
outPlanDetail.setWmStorageAreaId(wmStorageAreaOutPlan.getAreaId());
|
||||
outPlanDetail.setWmStorageAreaCode(wmStorageAreaOutPlan.getAreaCode());
|
||||
outPlanDetail.setWmStorageAreaName(wmStorageAreaOutPlan.getAreaName());
|
||||
outPlanDetail.setDetailState("1");
|
||||
outPlanDetail.setCreateTime(DateUtils.getNowDate());
|
||||
wmsOutPlanMapper.insertWmsOutPlanDetail(outPlanDetail);
|
||||
|
||||
// 遍历台账对象
|
||||
baseKnifeHashMapMap.get(mdItemId).get(areaCode).forEach(item -> {
|
||||
// 构建出库计划明细实体
|
||||
WmsOutPlanDetailEntity wmsOutPlanDetailEntity = new WmsOutPlanDetailEntity();
|
||||
wmsOutPlanDetailEntity.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId());
|
||||
wmsOutPlanDetailEntity.setBaseKnifeId(item.getBaseKnifeId());
|
||||
wmsOutPlanDetailEntity.setAreaCode(item.getAreaCode());
|
||||
wmsOutPlanDetailEntity.setItemOrProduct(item.getItemOrProduct());
|
||||
wmsOutPlanDetailEntity.setKnifeCode(item.getKnifeCode());
|
||||
wmsOutPlanDetailEntity.setKnifeName(item.getKnifeName());
|
||||
wmsOutPlanDetailEntity.setPlanSheet(item.getPlanSheet());
|
||||
wmsOutPlanDetailEntity.setKnifeLife(item.getKnifeLife());
|
||||
wmsOutPlanDetailEntity.setResetCount(item.getResetCount());
|
||||
wmsOutPlanDetailEntity.setKnifeUnit(item.getKnifeUnit());
|
||||
wmsOutPlanDetailEntity.setSafeStock(item.getKnifeType());
|
||||
wmsOutPlanDetailEntity.setStandardQuantity(item.getStandardQuantity());
|
||||
wmsOutPlanDetailEntity.setCreateTime(DateUtils.getNowDate());
|
||||
wmsOutPlanDetailEntityMapper.insertWmsOutPlanDetailEntity(wmsOutPlanDetailEntity);
|
||||
});
|
||||
|
||||
// 生成出库任务
|
||||
WmsOutTask wmsOutTask = new WmsOutTask();
|
||||
wmsOutTask.setWmsOutPlanId(outPlanTemp.getWmsOutPlanId());
|
||||
wmsOutTask.setWmsOutPlanCode(outPlanTemp.getPlanCode());
|
||||
wmsOutTask.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId());
|
||||
// 出库类型 12组刀出库
|
||||
wmsOutTask.setWmsBusinessTypeId(12L);
|
||||
wmsOutTask.setTaskCode(generateTaskCode("CKT"));
|
||||
wmsOutTask.setTaskNumber(outPlanDetail.getPlannedQuantity());
|
||||
wmsOutTask.setOutNumber(outPlanDetail.getRealQuantity());
|
||||
wmsOutTask.setWmStorageAreaId(outPlanDetail.getWmStorageAreaId());
|
||||
wmsOutTask.setBatchNum(batchNum);
|
||||
wmsOutTask.setMdItemId(outPlanDetail.getMdItemId());
|
||||
wmsOutTask.setMdItemCode(outPlanDetail.getMdItemCode());
|
||||
wmsOutTask.setMdItemName(outPlanDetail.getMdItemName());
|
||||
wmsOutTask.setMdItemUnit(outPlanDetail.getMdItemUnit());
|
||||
wmsOutTask.setTaskState("0");
|
||||
wmsOutTask.setRecipientUsername("");
|
||||
wmsOutTask.setCreateTime(DateUtils.getNowDate());
|
||||
wmsOutTaskMapper.insertWmsOutTask(wmsOutTask);
|
||||
});
|
||||
});
|
||||
|
||||
productionArrangements.setStatus(1);
|
||||
productionArrangementsMapper.updateProductionArrangements(productionArrangements);
|
||||
}
|
||||
}
|
||||
|
@ -223,12 +223,13 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
|
||||
// 判断是否需要锁定整刀
|
||||
if (lockedFlag) {
|
||||
baseKnife.setIsLocked(1);
|
||||
baseKnife.setKnifeFineState(2);
|
||||
baseKnife.setKnifeFineState(1);
|
||||
baseKnife.setLockedStartTime(technologyBom.getLockedStartTime());
|
||||
baseKnife.setLockedEndTime(technologyBom.getLockedEndTime());
|
||||
} else {
|
||||
baseKnife.setIsLocked(0);
|
||||
}
|
||||
|
||||
// attr4 计划编码, 整刀
|
||||
baseKnife.setPlanSheet(zdTask.getPlanSheet());
|
||||
baseKnife.setZdTaskId(zdTask.getWmsZdTaskId());
|
||||
@ -377,13 +378,13 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
|
||||
|
||||
// 整刀入库计划, 根据图号查询入库计划,如果不存在生成计划,存在则往计划中添加任务
|
||||
WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(zdTask.getAreaId());
|
||||
WmsInPlan wmsInPlan = wmsInPlanService.selectWmsInPlanByPlanCode(zdTask.getCode());
|
||||
WmsInPlan wmsInPlan = wmsInPlanService.selectWmsInPlanByPlanCode(zdTask.getPlanSheet());
|
||||
if (wmsInPlan == null) {
|
||||
WmsInPlan wmsInPlanTemp = new WmsInPlan();
|
||||
wmsInPlanTemp.setState("1");
|
||||
wmsInPlanTemp.setSourceType("ZDSC");
|
||||
wmsInPlanTemp.setSourceType(zdTask.getPlanSheet() != null ? "SCZB" : "ZZRW");
|
||||
wmsInPlanTemp.setCellCode(wmStorageArea.getAreaCode());
|
||||
wmsInPlanTemp.setPlanCode(zdTask.getCode());
|
||||
wmsInPlanTemp.setPlanCode(zdTask.getPlanSheet() != null ? zdTask.getPlanSheet() : zdTask.getCode());
|
||||
wmsInPlanTemp.setRelBillCode("组装单据");
|
||||
wmsInPlanTemp.setPlanTypeId("13");
|
||||
wmsInPlanTemp.setCreateBy(getUsername());
|
||||
@ -440,21 +441,21 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
|
||||
wmsInTask.setBatch(batchNum);
|
||||
wmsInTask.setMaterialId(zdTask.getmProductId().toString());
|
||||
wmsInTask.setPlanTypeId("9");
|
||||
wmsInTask.setPlanInStatus("1");
|
||||
wmsInTask.setPlanInStatus("0");
|
||||
wmsInTask.setDetailInId(wmsInPlan.getWmsInPlanDetailsList().get(0).getDetailsId());
|
||||
wmsInTask.setCreateBy(getUsername());
|
||||
wmsInTask.setCreateTime(DateUtils.getNowDate());
|
||||
wmsInTaskMapper.insertWmsInTask(wmsInTask);
|
||||
|
||||
// 整 刀台账设为有效
|
||||
baseKnifeList.forEach(baseKnife -> {
|
||||
baseKnife.setIsValid(0);
|
||||
baseKnife.setCreateTime(DateUtils.getNowDate());
|
||||
baseKnifeMapper.updateBaseKnife(baseKnife);
|
||||
});
|
||||
|
||||
// 检测订单是否完成,完成则出库整刀
|
||||
if (zdTask.getPlanSheet() != null && this.checkFinal(zdTask.getPlanSheet())) this.createOutTask(zdTask.getPlanSheet());
|
||||
// // 整 刀台账设为有效
|
||||
// baseKnifeList.forEach(baseKnife -> {
|
||||
// baseKnife.setIsValid(0);
|
||||
// baseKnife.setCreateTime(DateUtils.getNowDate());
|
||||
// baseKnifeMapper.updateBaseKnife(baseKnife);
|
||||
// });
|
||||
//
|
||||
// // 检测订单是否完成,完成则出库整刀
|
||||
// if (zdTask.getPlanSheet() != null && this.checkFinal(zdTask.getPlanSheet())) this.createOutTask(zdTask.getPlanSheet());
|
||||
|
||||
// 更新组装任务
|
||||
zdTask.setStatus("2");
|
||||
|
Loading…
Reference in New Issue
Block a user