Compare commits

...

41 Commits

Author SHA1 Message Date
9c3143e0bf refactor: 出库任务,优化 2024-12-20 14:13:38 +08:00
f11994376f fix: 自动分配,修复 2024-12-20 14:11:17 +08:00
7c420ab7a5 注释解开 2024-12-20 10:54:17 +08:00
19b97b234b 工具库生产准备 2024-12-20 10:52:52 +08:00
1d9e31b5fa fix: 执行入库任务修复 2024-12-20 10:05:40 +08:00
cf04961ff0 refactor: 组装任务修改 2024-12-20 09:19:09 +08:00
289df67850 refactor: 料箱mapper增加rfid字段 2024-12-20 08:57:30 +08:00
b7f1ad32e7 refactor: 根据料箱查询入库任务,修改 2024-12-20 08:57:10 +08:00
76e571359f refactor: 料箱字段类型修改 2024-12-19 17:02:30 +08:00
8987386691 refactor: 料箱字段类型修改 2024-12-19 16:43:34 +08:00
93be09a4de feat: 同步主数据管理平台数据 2024-12-19 16:42:57 +08:00
4f77b1921d refactor: 入库之后台账更新库位 2024-12-19 10:58:27 +08:00
d8357ea130 refactor: 出库计划编码自动生成 2024-12-19 10:48:43 +08:00
82929979fb 修改自动分配库位机制 2024-12-19 10:05:19 +08:00
b515389f38 Merge remote-tracking branch 'origin/master' 2024-12-19 10:00:42 +08:00
b26e4a31a1 出库时置空料箱库位字段 2024-12-19 10:00:33 +08:00
a8bf938f30 refactor: 执行入库后将库位信息填充,料箱 2024-12-19 09:49:05 +08:00
f253d12153 refactor: 说明文档更新 2024-12-19 09:48:16 +08:00
fe34ec181e Merge remote-tracking branch 'origin/master' 2024-12-19 09:17:07 +08:00
64477b68c7 attr1字段可置空更新 2024-12-19 09:16:11 +08:00
105ac642b5 Merge remote-tracking branch 'origin/master' 2024-12-19 09:15:05 +08:00
18a0416a28 refactor: 自动分配优化 2024-12-19 09:14:18 +08:00
47b4f94cd4 更新注释 2024-12-19 09:13:47 +08:00
2ce5028d07 增加料箱的库位支持 2024-12-19 09:12:03 +08:00
4711eac382 fix: 出库任务修复 2024-12-18 17:37:41 +08:00
25f3092b65 增加自动分配库位机制 2024-12-18 16:02:34 +08:00
f769bc17be 排除临时库位机制 2024-12-18 15:51:50 +08:00
7d69b2eafc 删除多余代码 2024-12-18 15:42:18 +08:00
f1129e8464 增加自动全部到临时库位机制 2024-12-18 15:35:40 +08:00
726d14eeb4 refactor: 根据料箱查询任务时,将料箱rfid绑定至相关任务 2024-12-18 14:25:27 +08:00
79d23c9e99 修复BUG 2024-12-18 11:25:10 +08:00
faa93f5d7b 增加根据库区编码与大小标记获取一个库位 2024-12-18 10:42:15 +08:00
c7edc4ea37 修正SQL语法错误 2024-12-18 10:29:01 +08:00
f14fd39c5c 增加对大小料箱的支持 2024-12-18 10:26:59 +08:00
d5b4647a12 接收扫描器传递来的数据 2024-12-18 10:02:25 +08:00
f2478d9e89 完善大号物料字段 2024-12-16 16:16:09 +08:00
968fdcee45 完善注释 2024-12-16 15:36:49 +08:00
9918b476dd 格式化代码 2024-12-16 15:19:38 +08:00
8b967dda27 增加注释 2024-12-16 14:41:43 +08:00
e6b8cbc848 完成出库任务公开列表增加台账实体数据 2024-12-16 11:12:18 +08:00
dab8541b37 完成出库计划新增接口,并自动执行出库计划,在数量等条件满足的情况下生成相应的出库任务 2024-12-16 11:09:33 +08:00
44 changed files with 3243 additions and 943 deletions

View File

@ -1,2 +1,10 @@
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">工刀具库WMS</h1>
<p align="center">
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">工具库WMS</h1>
<p align="center">
# 项目启动
## 1. 拉取Maven依赖
## 2. 手动添加DM依赖
### Hibernate5.4
`mvn install:install-file -Dfile=[jar包路径] -DgroupId=com.dm.dialect -DartifactId=hibernate5 -Dversion=5.4 -Dpackaging=jar`
### DmJdbc
`mvn install:install-file -Dfile=[jar包路径] -DgroupId=com.dm -DartifactId=DmJdbcDriver -Dversion=1.8 -Dpackaging=jar`

View File

@ -53,10 +53,25 @@
<artifactId>swagger-models</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>jcifs</groupId>
<artifactId>jcifs</artifactId>
<version>1.3.17</version>
</dependency>
<dependency>
<groupId>com.ktg</groupId>
<artifactId>ktg-generator</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!--CXF webservices-->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
<version>3.4.4</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,36 @@
package com.ktg.mes.md.config;
import com.ktg.mes.md.service.IMasterDataSyncService;
import lombok.RequiredArgsConstructor;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.xml.ws.Endpoint;
@Configuration
@RequiredArgsConstructor
public class WebServiceConfig {
private final IMasterDataSyncService masterDataSyncService;
@Bean(name = Bus.DEFAULT_BUS_ID)
public SpringBus springBus() {
return new SpringBus();
}
@Bean
public ServletRegistrationBean<CXFServlet> cxfServlet() {
return new ServletRegistrationBean<>(new CXFServlet(), "/WebServices/open/*");
}
@Bean
public Endpoint endpoint() {
EndpointImpl endpoint = new EndpointImpl(springBus(), masterDataSyncService);
endpoint.publish("/MasterDataSyncService");
return endpoint;
}
}

View File

@ -7,6 +7,7 @@ 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.poi.ExcelUtil;
import com.ktg.generator.util.MultiModuleCodeGenerator;
import com.ktg.mes.md.domain.WmsOutPlan;
import com.ktg.mes.md.domain.WmsOutPlanDetailEntity;
import com.ktg.mes.md.service.IWmsOutPlanService;
@ -40,6 +41,15 @@ public class WmsOutPlanController extends BaseController {
return getDataTable(list);
}
@PostMapping("/open/add")
public AjaxResult openAdd(@RequestBody WmsOutPlan wmsOutPlan) {
// 出库计划编码自动生成
if (wmsOutPlan.getPlanCode() == null || wmsOutPlan.getPlanCode().isEmpty()) {
wmsOutPlan.setPlanCode(MultiModuleCodeGenerator.generateTaskCode("CKP"));
}
return toAjax(wmsOutPlanService.insertWmsOutPlanAndRun(wmsOutPlan));
}
/**
* 查询出库计划管理列表
*/
@ -79,8 +89,12 @@ public class WmsOutPlanController extends BaseController {
@Log(title = "出库计划管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WmsOutPlan wmsOutPlan) {
if (UserConstants.NOT_UNIQUE.equals(wmsOutPlanService.checkPlanCodeUnique(wmsOutPlan))) {
return AjaxResult.error("新增出库计划失败,出库计划编码“" + wmsOutPlan.getPlanCode() + "”已存在");
// if (UserConstants.NOT_UNIQUE.equals(wmsOutPlanService.checkPlanCodeUnique(wmsOutPlan))) {
// return AjaxResult.error("新增出库计划失败,出库计划编码“" + wmsOutPlan.getPlanCode() + "”已存在");
// }
// 出库计划编码自动生成
if (wmsOutPlan.getPlanCode() == null || wmsOutPlan.getPlanCode().isEmpty()) {
wmsOutPlan.setPlanCode(MultiModuleCodeGenerator.generateTaskCode("CKP"));
}
wmsOutPlan.setCreateBy(getUsername());
return toAjax(wmsOutPlanService.insertWmsOutPlan(wmsOutPlan));

View File

@ -0,0 +1,134 @@
package com.ktg.mes.md.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 台账锁定对象 BASE_KNIFE_LOCKED
*
* @author yinjinlu
* @date 2024-12-09
*/
public class BaseKnifeLocked extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 刀具台账 */
@Excel(name = "刀具台账")
private Long baseKnifeId;
/** 计划单 */
@Excel(name = "计划单")
private String planSheet;
/** 计划单 */
@Excel(name = "物料编码")
private String itemCode;
/** 锁定开始时间 */
@Excel(name = "锁定开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lockedStartTime;
/** 锁定结束时间 */
@Excel(name = "锁定结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lockedEndTime;
/** 消耗定额 */
@Excel(name = "消耗定额")
private Integer expendLife;
/** 状态 */
@Excel(name = "状态")
private Integer status;
/** 主键ID */
private Long baseKnifeLockedId;
public void setBaseKnifeId(Long baseKnifeId)
{
this.baseKnifeId = baseKnifeId;
}
public Long getBaseKnifeId()
{
return baseKnifeId;
}
public void setPlanSheet(String planSheet)
{
this.planSheet = planSheet;
}
public String getPlanSheet()
{
return planSheet;
}
public void setLockedStartTime(Date lockedStartTime)
{
this.lockedStartTime = lockedStartTime;
}
public Date getLockedStartTime()
{
return lockedStartTime;
}
public void setLockedEndTime(Date lockedEndTime)
{
this.lockedEndTime = lockedEndTime;
}
public Date getLockedEndTime()
{
return lockedEndTime;
}
public void setBaseKnifeLockedId(Long baseKnifeLockedId)
{
this.baseKnifeLockedId = baseKnifeLockedId;
}
public Long getBaseKnifeLockedId()
{
return baseKnifeLockedId;
}
public String getItemCode() {
return itemCode;
}
public void setItemCode(String itemCode) {
this.itemCode = itemCode;
}
public Integer getExpendLife() {
return expendLife;
}
public void setExpendLife(Integer expendLife) {
this.expendLife = expendLife;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("baseKnifeId", getBaseKnifeId())
.append("planSheet", getPlanSheet())
.append("lockedStartTime", getLockedStartTime())
.append("lockedEndTime", getLockedEndTime())
.append("baseKnifeLockedId", getBaseKnifeLockedId())
.toString();
}
}

View File

@ -42,6 +42,10 @@ public class MbbProduBom extends BaseEntity
@Excel(name = "标准用量")
private Integer standardDosage;
/** 标准用量 */
@Excel(name = "当期库存")
private Long currentInventory;
/** 预留字段1 */
private String attr1;
@ -154,6 +158,14 @@ public class MbbProduBom extends BaseEntity
return attr4;
}
public Long getCurrentInventory() {
return currentInventory;
}
public void setCurrentInventory(Long currentInventory) {
this.currentInventory = currentInventory;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -39,8 +39,8 @@ public class MdItem extends BaseEntity {
private String highValue;
private Integer attr1;
private Integer attr2;
private String attr3;
private String attr4;
private Integer attr3;
private Integer attr4;
private Long count;
@ -203,19 +203,19 @@ public class MdItem extends BaseEntity {
this.attr2 = attr2;
}
public String getAttr3() {
public Integer getAttr3() {
return attr3;
}
public void setAttr3(String attr3) {
public void setAttr3(Integer attr3) {
this.attr3 = attr3;
}
public String getAttr4() {
public Integer getAttr4() {
return attr4;
}
public void setAttr4(String attr4) {
public void setAttr4(Integer attr4) {
this.attr4 = attr4;
}
@ -248,9 +248,9 @@ public class MdItem extends BaseEntity {
", maxStock=" + maxStock +
", highValue='" + highValue + '\'' +
", attr1=" + attr1 +
", attr2='" + attr2 + '\'' +
", attr3='" + attr3 + '\'' +
", attr4='" + attr4 + '\'' +
", attr2=" + attr2 +
", attr3=" + attr3 +
", attr4=" + attr4 +
", count=" + count +
'}';
}

View File

@ -0,0 +1,63 @@
package com.ktg.mes.md.domain;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class MyConfig {
@Value("${globalConfig.toolSettingXml.localPath}")
private String toolSettingXmlPath;
@Value("${globalConfig.toolSettingXml.remoteUrl}")
private String remoteUrl;
@Value("${globalConfig.toolSettingXml.remoteUser}")
private String remoteUser;
@Value("${globalConfig.toolSettingXml.remotePass}")
private String remotePass;
@Value("${globalConfig.productionControl.path}")
private String productionControlPath;
public String getToolSettingXmlPath() {
return toolSettingXmlPath;
}
public void setToolSettingXmlPath(String toolSettingXmlPath) {
this.toolSettingXmlPath = toolSettingXmlPath;
}
public String getProductionControlPath() {
return productionControlPath;
}
public void setProductionControlPath(String productionControlPath) {
this.productionControlPath = productionControlPath;
}
public String getRemoteUrl() {
return remoteUrl;
}
public void setRemoteUrl(String remoteUrl) {
this.remoteUrl = remoteUrl;
}
public String getRemoteUser() {
return remoteUser;
}
public void setRemoteUser(String remoteUser) {
this.remoteUser = remoteUser;
}
public String getRemotePass() {
return remotePass;
}
public void setRemotePass(String remotePass) {
this.remotePass = remotePass;
}
}

View File

@ -44,6 +44,11 @@ public class WmsOutTask extends BaseEntity {
@Excel(name = "出库类型ID")
private Long wmsBusinessTypeId;
/**
* 出库类型编码
*/
private String wmsBusinessTypeCode;
/**
* 任务编码
*/
@ -132,6 +137,38 @@ public class WmsOutTask extends BaseEntity {
private List<HashMap<String, Object>> outInfoList;
private List<BaseKnife> baseKnifes;
public WmsOutTask() {
super();
}
public WmsOutTask(Long wmsOutTaskId, Long wmsOutPlanId, String wmsOutPlanCode, Long wmsOutPlanDetailId, Long wmsBusinessTypeId, String wmsBusinessTypeCode, String taskCode, Integer taskNumber, Integer outNumber, Long wmStorageAreaId, String batchNum, Long mdItemId, String mdItemCode, String mdItemName, String mdItemUnit, String taskState, String recipientUsername, String attr1, String attr2, Integer attr3, Integer attr4, List<HashMap<String, Object>> outInfoList, List<BaseKnife> baseKnifes) {
this.wmsOutTaskId = wmsOutTaskId;
this.wmsOutPlanId = wmsOutPlanId;
this.wmsOutPlanCode = wmsOutPlanCode;
this.wmsOutPlanDetailId = wmsOutPlanDetailId;
this.wmsBusinessTypeId = wmsBusinessTypeId;
this.wmsBusinessTypeCode = wmsBusinessTypeCode;
this.taskCode = taskCode;
this.taskNumber = taskNumber;
this.outNumber = outNumber;
this.wmStorageAreaId = wmStorageAreaId;
this.batchNum = batchNum;
this.mdItemId = mdItemId;
this.mdItemCode = mdItemCode;
this.mdItemName = mdItemName;
this.mdItemUnit = mdItemUnit;
this.taskState = taskState;
this.recipientUsername = recipientUsername;
this.attr1 = attr1;
this.attr2 = attr2;
this.attr3 = attr3;
this.attr4 = attr4;
this.outInfoList = outInfoList;
this.baseKnifes = baseKnifes;
}
public Long getWmsOutTaskId() {
return wmsOutTaskId;
}
@ -172,6 +209,14 @@ public class WmsOutTask extends BaseEntity {
this.wmsBusinessTypeId = wmsBusinessTypeId;
}
public String getWmsBusinessTypeCode() {
return wmsBusinessTypeCode;
}
public void setWmsBusinessTypeCode(String wmsBusinessTypeCode) {
this.wmsBusinessTypeCode = wmsBusinessTypeCode;
}
public String getTaskCode() {
return taskCode;
}
@ -300,6 +345,14 @@ public class WmsOutTask extends BaseEntity {
this.outInfoList = outInfoList;
}
public List<BaseKnife> getBaseKnifes() {
return baseKnifes;
}
public void setBaseKnifes(List<BaseKnife> baseKnifes) {
this.baseKnifes = baseKnifes;
}
@Override
public String toString() {
return "WmsOutTask{" +
@ -308,6 +361,7 @@ public class WmsOutTask extends BaseEntity {
", wmsOutPlanCode='" + wmsOutPlanCode + '\'' +
", wmsOutPlanDetailId=" + wmsOutPlanDetailId +
", wmsBusinessTypeId=" + wmsBusinessTypeId +
", wmsBusinessTypeCode='" + wmsBusinessTypeCode + '\'' +
", taskCode='" + taskCode + '\'' +
", taskNumber=" + taskNumber +
", outNumber=" + outNumber +
@ -324,6 +378,7 @@ public class WmsOutTask extends BaseEntity {
", attr3=" + attr3 +
", attr4=" + attr4 +
", outInfoList=" + outInfoList +
", baseKnifes=" + baseKnifes +
'}';
}
}

View File

@ -0,0 +1,64 @@
package com.ktg.mes.md.mapper;
import com.ktg.mes.md.domain.BaseKnifeLocked;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 台账锁定Mapper接口
*
* @author yinjinlu
* @date 2024-12-09
*/
@Mapper
public interface BaseKnifeLockedMapper
{
/**
* 查询台账锁定
*
* @param baseKnifeLockedId 台账锁定主键
* @return 台账锁定
*/
public BaseKnifeLocked selectBaseKnifeLockedByBaseKnifeLockedId(String baseKnifeLockedId);
/**
* 查询台账锁定列表
*
* @param baseKnifeLocked 台账锁定
* @return 台账锁定集合
*/
public List<BaseKnifeLocked> selectBaseKnifeLockedList(BaseKnifeLocked baseKnifeLocked);
/**
* 新增台账锁定
*
* @param baseKnifeLocked 台账锁定
* @return 结果
*/
public int insertBaseKnifeLocked(BaseKnifeLocked baseKnifeLocked);
/**
* 修改台账锁定
*
* @param baseKnifeLocked 台账锁定
* @return 结果
*/
public int updateBaseKnifeLocked(BaseKnifeLocked baseKnifeLocked);
/**
* 删除台账锁定
*
* @param baseKnifeLockedId 台账锁定主键
* @return 结果
*/
public int deleteBaseKnifeLockedByBaseKnifeLockedId(String baseKnifeLockedId);
/**
* 批量删除台账锁定
*
* @param baseKnifeLockedIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteBaseKnifeLockedByBaseKnifeLockedIds(String[] baseKnifeLockedIds);
}

View File

@ -121,4 +121,8 @@ public interface BaseKnifeMapper {
public Boolean isDuplicateRfid(String rfid);
List<BaseKnife> selectBaseKnifeNotValidList(BaseKnife baseKnifeWrapper);
List<String> selectNotEmptyAreaCodeList();
List<BaseKnife> selectBaseKnifeListByMbbBdMrlId(Long itemId);
}

View File

@ -2,6 +2,7 @@ package com.ktg.mes.md.mapper;
import java.util.List;
import com.ktg.mes.md.domain.BaseTechnologyBom;
import org.apache.ibatis.annotations.Mapper;
/**
* 工艺bomMapper接口
@ -9,6 +10,7 @@ import com.ktg.mes.md.domain.BaseTechnologyBom;
* @author yinjinlu
* @date 2024-11-01
*/
@Mapper
public interface BaseTechnologyBomMapper
{
/**

View File

@ -3,6 +3,7 @@ package com.ktg.mes.md.mapper;
import java.util.List;
import com.ktg.mes.md.domain.WmsOutPlanDetailEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 出库计划明细实体Mapper接口
@ -10,6 +11,7 @@ import com.ktg.mes.md.domain.WmsOutPlanDetailEntity;
* @author yinjinlu
* @date 2024-11-11
*/
@Mapper
public interface WmsOutPlanDetailEntityMapper {
/**
* 查询出库计划明细实体

View File

@ -2,6 +2,7 @@ package com.ktg.mes.md.mapper;
import com.ktg.mes.md.domain.WmsOutPlan;
import com.ktg.mes.md.domain.WmsOutPlanDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -12,6 +13,7 @@ import java.util.List;
* @author yinjinlu
* @date 2024-11-01
*/
@Mapper
public interface WmsOutPlanMapper {
/**
* 查询出库计划管理

View File

@ -1,6 +1,7 @@
package com.ktg.mes.md.mapper;
import com.ktg.mes.md.domain.WmsOutTask;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@ -10,6 +11,7 @@ import java.util.List;
* @author yinjinlu
* @date 2024-11-02
*/
@Mapper
public interface WmsOutTaskMapper {
/**
* 查询出库任务

View File

@ -0,0 +1,40 @@
package com.ktg.mes.md.service;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
@WebService(name = IMasterDataSyncService.SERVICE_NAME, targetNamespace = IMasterDataSyncService.TARGET_NAMESPACE)
public interface IMasterDataSyncService {
String SERVICE_NAME = "MasterDataSyncService";
String TARGET_NAMESPACE = "http://server.spring.zhang.pers/";
/**
* 同步物料数据
*
* @param materialListStr 物料列表
*/
@WebMethod(operationName = "syncMaterial")
@WebResult
String syncMaterial(@WebParam(name = "materialListStr") String materialListStr);
/**
* 同步物料分类数据
*
* @param materialCategoryListStr 物料分类列表
*/
@WebMethod(operationName = "syncMaterialCategory")
@WebResult
String syncMaterialCategory(@WebParam(name = "materialCategoryList") String materialCategoryListStr);
/**
* 同步计量单位数据
*
* @param unitListStr 计量单位列表
*/
@WebMethod(operationName = "syncUnit")
@WebResult
String syncUnit(@WebParam(name = "unitList") String unitListStr);
}

View File

@ -29,6 +29,14 @@ public interface IWmsOutPlanService {
*/
List<WmsOutPlan> selectWmsOutPlanList(WmsOutPlan wmsOutPlan);
/**
* 新增出库计划管理并执行
*
* @param wmsOutPlan 出库计划管理
* @return 结果
*/
int insertWmsOutPlanAndRun(WmsOutPlan wmsOutPlan);
/**
* 新增出库计划管理
*

View File

@ -2,6 +2,7 @@ package com.ktg.mes.md.service.impl;
import java.util.List;
import com.ktg.common.utils.DateUtils;
import com.ktg.mes.md.mapper.BaseKnifeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@ -24,6 +25,9 @@ public class BomRouteServiceImpl implements IBomRouteService
@Autowired
private BomRouteMapper bomRouteMapper;
@Autowired
private BaseKnifeMapper baseKnifeMapper;
/**
* 查询BOM头
*
@ -33,7 +37,11 @@ public class BomRouteServiceImpl implements IBomRouteService
@Override
public BomRoute selectBomRouteByBomRouteId(Long bomRouteId)
{
return bomRouteMapper.selectBomRouteByBomRouteId(bomRouteId);
BomRoute bomRoute = bomRouteMapper.selectBomRouteByBomRouteId(bomRouteId);
bomRoute.getMbbProduBomList().forEach(item -> {
item.setCurrentInventory(this.baseKnifeMapper.countBaseKnife(item.getMdItemId()));
});
return bomRoute;
}
/**

View File

@ -0,0 +1,189 @@
package com.ktg.mes.md.service.impl;
import com.ktg.common.core.domain.entity.ItemType;
import com.ktg.mes.md.domain.MdItem;
import com.ktg.mes.md.domain.MdUnitMeasure;
import com.ktg.mes.md.service.IMasterDataSyncService;
import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.md.service.IMdUnitMeasureService;
import lombok.RequiredArgsConstructor;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.ObjectMapper;
import org.springframework.stereotype.Service;
import javax.jws.WebService;
import java.util.List;
@RequiredArgsConstructor
@Service
@WebService(name = IMasterDataSyncService.SERVICE_NAME, targetNamespace = IMasterDataSyncService.TARGET_NAMESPACE, endpointInterface = "com.ktg.mes.md.service.IMasterDataSyncService")
public class MasterDataSyncServiceImpl implements IMasterDataSyncService {
private final ItemTypeServiceImpl itemTypeService;
private final IMdItemService mdItemService;
private final IMdUnitMeasureService mdUnitMeasureService;
// 无参构造函数 CXF 使用
public MasterDataSyncServiceImpl() {
this.itemTypeService = null;
this.mdItemService = null;
this.mdUnitMeasureService = null;
}
/**
* 同步物料数据
*
* @param materialListStr 物料列表
*/
@Override
public String syncMaterial(String materialListStr) {
// 使用 ObjectMapper 来处理 JSON
ObjectMapper objectMapper = new ObjectMapper();
try {
// 解析传入的 JSON 字符串
String jsonList = objectMapper.readTree(materialListStr).get("LIST").asText();
JsonNode jsonNode = objectMapper.readTree(jsonList);
for (JsonNode node : jsonNode) {
JsonNode jsonNode1 = null;
// 通用工具工装
if (!node.get("T_TYGJGZ").asText().isEmpty()) {
jsonNode1 = objectMapper.readTree(node.get("T_TYGJGZ").asText());
// 专用工具工装
} else if (!node.get("T_ZYGJGZ").asText().isEmpty()) {
jsonNode1 = objectMapper.readTree(node.get("T_ZYGJGZ").asText());
}
if (jsonNode1 != null) {
MdItem mdItem = new MdItem();
mdItem.setItemName(jsonNode1.get("MC").asText());
mdItem.setItemCode(jsonNode1.get("WLBM").asText());
// 查询并设置计量单位数据
MdUnitMeasure unit = mdUnitMeasureService.selectMdUnitByCode(jsonNode1.get("UNIT").asText());
mdItem.setUnitName(unit.getMeasureName());
mdItem.setUnitOfMeasure(unit.getMeasureName());
// 四级分类数据
String categoryName = jsonNode1.get("SIJFL").asText();
if (categoryName.isEmpty()) {
// 为空则使用三级分类数据
categoryName = jsonNode1.get("SJFL").asText();
}
ItemType itemType = itemTypeService.selectItemTypeByName(categoryName);
mdItem.setItemOrProduct(itemType.getItemOrProduct());
mdItem.setItemTypeId(itemType.getItemTypeId());
mdItem.setItemTypeName(itemType.getItemTypeName());
mdItemService.insertMdItem(mdItem);
}
}
} catch (Exception e) {
e.printStackTrace();
return "同步失败,原因:" + e.getMessage();
}
return "1"; // 返回成功标识
}
/**
* 同步物料分类数据
*
* @param materialCategoryListStr 物料分类列表
*/
@Override
public String syncMaterialCategory(String materialCategoryListStr) {
// 使用 ObjectMapper 来处理 JSON
ObjectMapper objectMapper = new ObjectMapper();
try {
// 解析传入的 JSON 字符串
String jsonList = objectMapper.readTree(materialCategoryListStr).get("LIST").asText();
JsonNode jsonNode = objectMapper.readTree(jsonList);
for (JsonNode node : jsonNode) {
ItemType itemType = new ItemType();
itemType.setItemTypeName(node.get("NAME").asText());
itemType.setItemTypeCode(node.get("CODE").asText());
// 判断是否有父级分类
String parentCode = node.get("PCODE").asText();
if (!parentCode.isEmpty()) {
ItemType itemTypeQuery = new ItemType();
itemTypeQuery.setItemTypeCode(parentCode);
// 查询父级数据
List<ItemType> parentItemTypeList = itemTypeService.selectItemTypeList(itemTypeQuery);
if (!parentItemTypeList.isEmpty()) {
ItemType parentItemType = parentItemTypeList.get(0);
itemType.setParentTypeId(parentItemType.getItemTypeId());
// 提取父级分类ID
Long parentId = parentItemType.getParentTypeId();
// 循环直至查出最顶层分类
while (parentId != null && parentId != 0) {
parentItemType = itemTypeService.selectItemTypeById(parentId);
if (parentItemType != null) {
// 更新父级 ID
parentId = parentItemType.getParentTypeId();
// 判断分类名称设置对应的物料类型
if ("专用刀具".equals(parentItemType.getItemTypeName()) || "刀具".equals(parentItemType.getItemTypeName())) {
itemType.setItemOrProduct("BLAND");
break;
} else if (parentId == 0) {
itemType.setItemOrProduct("ITEM");
break;
}
} else {
break;
}
}
}
}
// 插入数据
itemTypeService.insertItemType(itemType);
}
} catch (Exception e) {
e.printStackTrace();
return "同步失败,原因:" + e.getMessage();
}
return "1"; // 返回成功标识
}
/**
* 同步计量单位数据
*
* @param unitListStr 计量单位列表
*/
@Override
public String syncUnit(String unitListStr) {
// 使用 ObjectMapper 来处理 JSON
ObjectMapper objectMapper = new ObjectMapper();
try {
// 解析传入的 JSON 字符串
String jsonList = objectMapper.readTree(unitListStr).get("LIST").asText();
JsonNode jsonNode = objectMapper.readTree(jsonList);
for (JsonNode node : jsonNode) {
JsonNode jsonNode1 = objectMapper.readTree(node.get("DIC_D_UNIT").asText());
if (jsonNode1 != null) {
MdUnitMeasure mdUnitMeasure = new MdUnitMeasure();
mdUnitMeasure.setMeasureCode(jsonNode1.get("CODE").asText());
mdUnitMeasure.setMeasureName(jsonNode1.get("NAME").asText());
mdUnitMeasureService.insertMdUnitMeasure(mdUnitMeasure);
}
}
} catch (Exception e) {
e.printStackTrace();
return "同步失败,原因:" + e.getMessage();
}
return "1"; // 返回成功标识
}
}

View File

@ -73,6 +73,16 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
return wmsOutPlanList;
}
@Transactional
@Override
public int insertWmsOutPlanAndRun(WmsOutPlan wmsOutPlan) {
wmsOutPlan.setCreateTime(DateUtils.getNowDate());
int rows = wmsOutPlanMapper.insertWmsOutPlan(wmsOutPlan);
insertWmsOutPlanDetail(wmsOutPlan);
this.runWmsOutPlan(new Long[]{wmsOutPlan.getWmsOutPlanId()});
return rows;
}
/**
* 新增出库计划管理
*

View File

@ -1,21 +1,37 @@
package com.ktg.mes.md.service.impl;
import com.alibaba.fastjson.JSON;
import com.ktg.common.utils.DateUtils;
import com.ktg.mes.cal.utils.CalendarUtil;
import com.ktg.mes.md.domain.*;
import com.ktg.mes.md.mapper.*;
import com.ktg.mes.md.service.IWmsOutTaskService;
import com.ktg.mes.wm.domain.UcmCtBase;
import com.ktg.mes.wm.domain.UcmCtMaterial;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.WmsZdTask;
import com.ktg.mes.wm.mapper.UcmCtBaseMapper;
import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
import com.ktg.mes.wm.service.IWmStorageAreaService;
import com.ktg.mes.wm.mapper.WmsZdTaskMapper;
import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbFile;
import jcifs.smb.SmbFileInputStream;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.FileTime;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
* 出库任务Service业务层处理
@ -46,6 +62,15 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
@Autowired
private WmStorageAreaMapper wmStorageAreaMapper;
@Autowired
private UcmCtBaseMapper ucmCtBaseMapper;
@Autowired
private UcmCtMaterialMapper2 ucmCtMaterialMapper2;
@Autowired
private WmsZdTaskMapper wmsZdTaskMapper;
/**
* 查询出库任务
*
@ -67,7 +92,8 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
entityQuery.setWmsOutPlanDetailId(wmsOutTask.getWmsOutPlanDetailId());
List<WmsOutPlanDetailEntity> wmsOutPlanDetailEntityList = wmsOutPlanDetailEntityMapper.selectWmsOutPlanDetailEntityList(entityQuery);
wmsOutPlanDetailEntityList.forEach(nowWmsOutPlanDetailEntity -> {
wmsOutPlanDetailEntityList.subList(0, wmsOutTask.getOutNumber()).forEach(nowWmsOutPlanDetailEntity -> {
// 根据出库实例对象获取出库计划明细
WmsOutPlanDetail wmsOutPlanDetail = this.wmsOutPlanMapper.selectWmsOutPlanDetailById(nowWmsOutPlanDetailEntity.getWmsOutPlanDetailId());
@ -78,7 +104,7 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
WmsBusinessType wmsBusinessType = this.wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(wmsOutPlan.getWmsBusinessTypeId().toString());
// 获取库位信息
WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(wmsOutPlanDetail.getWmStorageAreaId());
WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaCode(nowWmsOutPlanDetailEntity.getAreaCode());
// 设定出库信息数据
HashMap<String, Object> hashMap = new HashMap<>();
@ -98,9 +124,9 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
hashMap.put("planTypeName", wmsBusinessType.getName()); // 出库类型名称
/* 来自计划明细 */
hashMap.put("detailBatchNum", wmsOutPlanDetail.getDetailBatchNum()); // 明细批次
hashMap.put("wmStorageAreaId", wmsOutPlanDetail.getWmStorageAreaId()); // 库位ID
hashMap.put("wmStorageAreaCode", wmsOutPlanDetail.getWmStorageAreaCode()); // 库位编码
hashMap.put("wmStorageAreaName", wmsOutPlanDetail.getWmStorageAreaName()); // 库位名称
hashMap.put("wmStorageAreaId", wmStorageArea.getAreaId()); // 库位ID
hashMap.put("wmStorageAreaCode", wmStorageArea.getAreaCode()); // 库位编码
hashMap.put("wmStorageAreaName", wmStorageArea.getAreaName()); // 库位名称
hashMap.put("cellX", wmStorageArea.getPositionX().toString());
hashMap.put("cellY", wmStorageArea.getPositionY().toString());
hashMap.put("cellZ", wmStorageArea.getPositionZ().toString());
@ -136,7 +162,15 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
*/
@Override
public List<WmsOutTask> selectWmsOutTaskList(WmsOutTask wmsOutTask) {
return wmsOutTaskMapper.selectWmsOutTaskList(wmsOutTask);
List<WmsOutTask> wmsOutTaskList = wmsOutTaskMapper.selectWmsOutTaskList(wmsOutTask);
wmsOutTaskList.forEach(nowWmsOutTask -> {
WmsOutPlanDetailEntity entityQuery = new WmsOutPlanDetailEntity();
entityQuery.setWmsOutPlanDetailId(nowWmsOutTask.getWmsOutPlanDetailId());
nowWmsOutTask.setBaseKnifes(wmsOutPlanDetailEntityMapper.selectWmsOutPlanDetailEntityList(entityQuery).stream()
.map(it -> this.baseKnifeMapper.selectBaseKnifeByBaseKnifeId(it.getBaseKnifeId()))
.filter(Objects::nonNull).collect(Collectors.toList()));
});
return wmsOutTaskList;
}
/**
@ -205,15 +239,69 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
2,
1
);
// 获取料箱明细
UcmCtMaterial ucmCtMaterialQuery = new UcmCtMaterial();
ucmCtMaterialQuery.setBaseKnifeId(wmsOutPlanDetailEntity.getBaseKnifeId());
List<UcmCtMaterial> ucmCtMaterials = this.ucmCtMaterialMapper2.selectUcmCtMaterialList(ucmCtMaterialQuery);
ucmCtMaterials.forEach(ucmCtMaterial -> {
UcmCtBase ucmCtBase = this.ucmCtBaseMapper.selectUcmCtBaseByCtBaseId(ucmCtMaterial.getCtBaseId().toString());
if (ucmCtBase != null) {
ucmCtBase.setAttr1(null);
this.ucmCtBaseMapper.updateUcmCtBase(ucmCtBase);
}
});
}
// 更新出库任务状态
wmsOutTask.setTaskState("1");
wmsOutTaskMapper.updateWmsOutTask(wmsOutTask);
// 完成标识
boolean flag = true;
// 判断是否来自组装任务
WmsZdTask wmsZdTaskWrapper = new WmsZdTask();
wmsZdTaskWrapper.setCode(wmsOutTask.getWmsOutPlanCode());
List<WmsZdTask> wmsZdTaskList = wmsZdTaskMapper.selectWmsZdTaskList(wmsZdTaskWrapper);
if (!wmsZdTaskList.isEmpty()) {
// 获取组装任务
WmsZdTask wmsZdTask = wmsZdTaskList.get(0);
// 检测是否完成
WmsOutTask wmsOutTaskWrapper = new WmsOutTask();
wmsOutTaskWrapper.setWmsOutPlanCode(wmsZdTask.getCode());
List<WmsOutTask> wmsOutTaskList = wmsOutTaskMapper.selectWmsOutTaskList(wmsOutTaskWrapper);
// 遍历状态
for (WmsOutTask item : wmsOutTaskList) {
if (Objects.equals("0", item.getTaskState())) {
flag = false;
break;
}
}
}
if (flag) {
this.wmsZdTaskFinish(wmsOutTask.getWmsOutPlanCode());
}
}
return true;
}
public void wmsZdTaskFinish(String planCode) {
WmsZdTask wmsZdTaskWrapper = new WmsZdTask();
wmsZdTaskWrapper.setCode(planCode);
List<WmsZdTask> wmsZdTaskList = wmsZdTaskMapper.selectWmsZdTaskList(wmsZdTaskWrapper);
if (!wmsZdTaskList.isEmpty()) {
// 获取组装任务 更新状态
WmsZdTask wmsZdTask = wmsZdTaskList.get(0);
wmsZdTask.setStatus("1");
wmsZdTaskMapper.updateWmsZdTask(wmsZdTask);
}
}
@Transactional
@Override
public boolean autoRunWmsOutTask(Long[] wmsOutTaskIds) {

View File

@ -1,32 +1,37 @@
package com.ktg.mes.wm.controller;
import com.alibaba.fastjson.JSON;
import com.ktg.common.annotation.Log;
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.cal.utils.CalendarUtil;
import com.ktg.mes.md.domain.*;
import com.ktg.mes.md.mapper.*;
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.mapper.ProductionArrangementsMapper;
import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
import com.ktg.mes.wm.service.*;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Stream;
import java.io.IOException;
import java.util.*;
import static com.ktg.generator.util.MultiModuleCodeGenerator.generateTaskCode;
/**
* 入库任务Controller
@ -43,6 +48,20 @@ public class WmsInTaskController extends BaseController {
private final IBaseKnifeService baseKnifeService;
private final IWmStorageAreaService wmStorageAreaService;
private final IWmsInPlanDetailEntityService wmsInPlanDetailEntityService;
private final WmsOutPlanDetailEntityMapper wmsOutPlanDetailEntityMapper;
private final IUcmCtBaseService ucmCtBaseService;
private final IWmStorageLocationService wmStorageLocationService;
private final BaseKnifeLockedMapper baseKnifeLockedMapper;
private final IUcmCtBaseService umcCtBaseService;
private final ProductionArrangementsMapper productionArrangementsMapper;
private final BaseTechnologyBomMapper baseTechnologyBomMapper;
private final BaseKnifeMapper baseKnifeMapper;
private final WmsOutPlanMapper wmsOutPlanMapper;
private final WmsOutTaskMapper wmsOutTaskMapper;
private final MdItemMapper mdItemMapper;
private final WmStorageAreaMapper wmStorageAreaMapper;
private final MyConfig myConfig;
/**
* 查询入库任务列表
@ -95,6 +114,28 @@ public class WmsInTaskController extends BaseController {
if (wmsInTask == null) {
return AjaxResult.error("未查询到相关任务");
}
// 获得料箱
UcmCtBase ucmCtBaseByCode = ucmCtBaseService.selectUcmCtBaseByCode(rfid);
if (ucmCtBaseByCode == null) {
return AjaxResult.error("未查询到相关料箱");
}
// 自动分配非临时库位
if (wmsInTask.getCellCode().equals("TEMP")) {
WmStorageArea wmStorageArea = this.wmStorageLocationService.queryOneAreaByLocationCode("DDJ01", ucmCtBaseByCode.getAttr3() != null && ucmCtBaseByCode.getAttr3() == 1);
wmsInTask.setCellTgt(wmStorageArea.getAreaId());
wmsInTask.setCellName(wmStorageArea.getAreaName());
wmsInTask.setCellCode(wmStorageArea.getAreaCode());
wmsInTask.setCellX(wmStorageArea.getPositionX().toString());
wmsInTask.setCellY(wmStorageArea.getPositionY().toString());
wmsInTask.setCellZ(wmStorageArea.getPositionZ().toString());
}
// 将料箱rfid绑定至任务
wmsInTask.setBoxRfid(rfid);
wmsInTaskService.updateWmsInTask(wmsInTask);
return AjaxResult.success(wmsInTask);
}
@ -153,23 +194,67 @@ public class WmsInTaskController extends BaseController {
// 入库类型为整刀回库
if (Objects.equals(wmsInTask.getPlanTypeId(), "9")) {
// 将库位信息填充至料箱
UcmCtBase ucmCtBase = ucmCtBaseService.selectUcmCtBaseByCode(wmsInTask.getBoxRfid());
ucmCtBase.setAttr1(wmsInTask.getCellTgt().toString());
ucmCtBaseService.updateUcmCtBase(ucmCtBase);
// 插入台账数据
wmsInPlanDetailEntityList.forEach(planDetailEntity -> {
BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(planDetailEntity.getKnifeId());
// 计算消耗寿命
int consumeLife = baseKnife.getKnifeLife() - (planDetailEntity.getConsumeLife() % 100);
baseKnife.setKnifeLife(consumeLife);
// 计算重置次数
int resetCount = baseKnife.getResetCount() - (planDetailEntity.getConsumeLife() / 100);
baseKnife.setResetCount(resetCount);
// 设置状态为 解锁
baseKnife.setIsLocked(0);
// 设置工具状态 已入库
baseKnife.setKnifeFineState(1);
if (StringUtils.isNotEmpty(planDetailEntity.getRfid())) {
baseKnife.setRfid(planDetailEntity.getRfid());
}
// 状态为生效
baseKnife.setIsValid(0);
// 设置库位信息
baseKnife.setAreaCode(wmStorageArea.getAreaCode());
baseKnife.setAreaName(wmStorageArea.getAreaName());
// 更新台账状态
baseKnifeService.updateBaseKnife(baseKnife);
// 判断物料是否有绑定了订单
if (baseKnife.getPlanSheet() != null){
// 获取台账锁定实体并将状态设置为已完成
BaseKnifeLocked baseKnifeLockedWrapper = new BaseKnifeLocked();
baseKnifeLockedWrapper.setStatus(0);
baseKnifeLockedWrapper.setBaseKnifeId(baseKnife.getBaseKnifeId());
baseKnifeLockedWrapper.setPlanSheet(baseKnife.getPlanSheet());
List<BaseKnifeLocked> baseKnifeLockedList = baseKnifeLockedMapper.selectBaseKnifeLockedList(baseKnifeLockedWrapper);
// 获取实体并修改状态
BaseKnifeLocked baseKnifeLocked;
if (!baseKnifeLockedList.isEmpty()){
baseKnifeLocked = baseKnifeLockedList.get(0);
baseKnifeLocked.setStatus(1);
baseKnifeLockedMapper.updateBaseKnifeLocked(baseKnifeLocked);
}
// 再次查询物料是否有预订订单
baseKnifeLockedWrapper.setPlanSheet(null);
baseKnifeLockedList = baseKnifeLockedMapper.selectBaseKnifeLockedList(baseKnifeLockedWrapper);
if (!baseKnifeLockedList.isEmpty()){
baseKnifeLocked = baseKnifeLockedList.get(0);
baseKnife.setPlanSheet(baseKnifeLocked.getPlanSheet());
baseKnife.setIsLocked(1);
baseKnife.setLockedStartTime(baseKnifeLocked.getLockedStartTime());
baseKnife.setLockedEndTime(baseKnifeLocked.getLockedEndTime());
baseKnifeService.updateBaseKnife(baseKnife);
// 检测订单是否完成完成则出库整刀
if (this.checkFinal(baseKnifeLocked.getPlanSheet())) {
try {
this.createOutTask(baseKnifeLocked.getPlanSheet());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
} else {
// 订单解绑
baseKnife.setPlanSheet("");
baseKnifeService.updateBaseKnife(baseKnife);
}
}
});
} else if (Objects.equals(wmsInTask.getPlanTypeId(), "15")) {
// 拆刀回库
@ -216,6 +301,11 @@ public class WmsInTaskController extends BaseController {
});
mdItemService.updateMdItem(mbbBdMrlMitm);
} else if (Objects.equals(wmsInTask.getPlanTypeCode(), "CGRK")) {
// 将库位信息填充至料箱
UcmCtBase ucmCtBase = ucmCtBaseService.selectUcmCtBaseByCode(wmsInTask.getBoxRfid());
ucmCtBase.setAttr1(wmsInTask.getCellTgt().toString());
ucmCtBaseService.updateUcmCtBase(ucmCtBase);
// 插入台账数据
wmsInPlanDetailEntityList.forEach(planDetailEntity -> {
BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(planDetailEntity.getKnifeId());
// 设置状态为 解锁
@ -224,10 +314,18 @@ public class WmsInTaskController extends BaseController {
baseKnife.setKnifeFineState(1);
// 状态为生效
baseKnife.setIsValid(0);
// 设置库位信息
baseKnife.setAreaCode(wmStorageArea.getAreaCode());
baseKnife.setAreaName(wmStorageArea.getAreaName());
// 更新台账状态
baseKnifeService.updateBaseKnife(baseKnife);
});
} else if (Objects.equals(wmsInTask.getPlanTypeCode(), "GJHK")) {
// 将库位信息填充至料箱
UcmCtBase ucmCtBase = ucmCtBaseService.selectUcmCtBaseByCode(wmsInTask.getBoxRfid());
ucmCtBase.setAttr1(wmsInTask.getCellTgt().toString());
ucmCtBaseService.updateUcmCtBase(ucmCtBase);
// 插入台账数据
wmsInPlanDetailEntityList.forEach(planDetailEntity -> {
BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(planDetailEntity.getKnifeId());
// 设置状态为 解锁
@ -236,6 +334,9 @@ public class WmsInTaskController extends BaseController {
baseKnife.setKnifeFineState(1);
// 状态为生效
baseKnife.setIsValid(0);
// 设置库位信息
baseKnife.setAreaCode(wmStorageArea.getAreaCode());
baseKnife.setAreaName(wmStorageArea.getAreaName());
// 更新台账状态
baseKnifeService.updateBaseKnife(baseKnife);
});
@ -265,4 +366,209 @@ 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) throws IOException {
// 构建出库计划
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);
// 给产线控制系统发指令
this.productionArrangementsIsOk(productionArrangements);
}
// 调用生产准备完成接口
public void productionArrangementsIsOk(ProductionArrangements productionArrangements) throws IOException {
// 产线控制系统生产准备完成接口
String url = myConfig.getProductionControlPath() + "/cutterapi/cutComplete";
// 请求客户端
OkHttpClient client = new OkHttpClient();
// 构建请求数据
Map<String, Object> requestMap = new HashMap<>();
requestMap.put("prodordercode", productionArrangements.getPlanSheet());
requestMap.put("result", "0");
requestMap.put("completetime", CalendarUtil.getDateTimeStr());
// 获取工艺信息
BaseTechnologyBom technologyBomWrapper = new BaseTechnologyBom();
technologyBomWrapper.setTechnologyCode(productionArrangements.getTechnologyCode());
List<BaseTechnologyBom> technologyBomList = baseTechnologyBomMapper.selectBaseTechnologyBomList(technologyBomWrapper);
BaseKnife baseKnifeWrapper = new BaseKnife();
baseKnifeWrapper.setPlanSheet(productionArrangements.getPlanSheet());
// 获取刀具信息
List<Map<String, String>> cutterList = new ArrayList<>();
technologyBomList.forEach(baseTechnologyBom -> {
baseKnifeWrapper.setKnifeCode(baseTechnologyBom.getKnifeCode());
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper);
baseKnifeList.forEach(baseKnife -> {
Map<String, String> map = new HashMap<>();
map.put("specno", baseTechnologyBom.getProcessCode());
map.put("code", baseKnife.getKnifeCode());
map.put("name", baseKnife.getKnifeName());
map.put("life", baseKnife.getKnifeLife().toString());
cutterList.add(map);
});
});
requestMap.put("cutterinfo", cutterList);
// 构建请求数据
MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
okhttp3.RequestBody requestBody = okhttp3.RequestBody.create(mediaType, JSON.toJSONString(requestMap));
// 请求体
Request request = new Request.Builder()
.url(url)
.post(requestBody)
.build();
// 发送请求
try(Response response = client.newCall(request).execute()) {
if (!response.isSuccessful())
throw new IOException("Unexpected code " + response);
// 请求响应
String responseBody = response.body().string();
System.out.println(responseBody);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

View File

@ -1,11 +1,12 @@
package com.ktg.mes.wm.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
import java.util.List;
import java.sql.Date;
/**
* 生产准备记录对象 PRODUCTION_ARRANGEMENTS
@ -35,6 +36,12 @@ public class ProductionArrangements extends BaseEntity
@Excel(name = "状态")
private Integer status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
/** 预留字段1 */
@Excel(name = "预留字段1")
private String attr1;
@ -133,6 +140,23 @@ public class ProductionArrangements extends BaseEntity
return attr4;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
@Override
public String toString() {
return "ProductionArrangements{" +

View File

@ -1,112 +1,116 @@
package com.ktg.mes.wm.domain;
import com.ktg.mes.md.domain.BaseKnife;
import com.ktg.mes.md.domain.MbbProduBom;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
import com.ktg.mes.md.domain.BaseKnife;
import java.util.List;
/**
* 料箱管理对象 UCM_CT_BASE
*
*
* @author yinjinlu
* @date 2024-10-31
*/
public class UcmCtBase extends BaseEntity
{
public class UcmCtBase extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 料箱id */
/**
* 料箱id
*/
private String ctBaseId;
/** 料箱编码 */
/**
* 料箱编码
*/
@Excel(name = "料箱编码")
private String code;
/** 料箱状态0-正常1-绑定2-解绑 */
/**
* 料箱状态0-正常1-绑定2-解绑
*/
@Excel(name = "料箱状态0-正常1-绑定2-解绑")
private String type;
/** 预留字段1 */
/**
* 预留字段1表示当前料箱所在库位ID
*/
private String attr1;
/** 预留字段2 */
/**
* 预留字段2
*/
private String attr2;
/** 预留字段3 */
private String attr3;
/**
* 预留字段3为空或者0表示普通料箱为1表示大号料箱
*/
private Integer attr3;
/** 预留字段4 */
private String attr4;
/**
* 预留字段4
*/
private Integer attr4;
/** BOM物料信息 */
/**
* BOM物料信息
*/
private List<BaseKnife> baseKnifeList;
public void setCtBaseId(String ctBaseId)
{
public void setCtBaseId(String ctBaseId) {
this.ctBaseId = ctBaseId;
}
public String getCtBaseId()
{
public String getCtBaseId() {
return ctBaseId;
}
public void setCode(String code)
{
public void setCode(String code) {
this.code = code;
}
public String getCode()
{
public String getCode() {
return code;
}
public void setType(String type)
{
public void setType(String type) {
this.type = type;
}
public String getType()
{
public String getType() {
return type;
}
public void setAttr1(String attr1)
{
public void setAttr1(String attr1) {
this.attr1 = attr1;
}
public String getAttr1()
{
public String getAttr1() {
return attr1;
}
public void setAttr2(String attr2)
{
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
public String getAttr2()
{
public String getAttr2() {
return attr2;
}
public void setAttr3(String attr3)
{
public Integer getAttr3() {
return attr3;
}
public void setAttr3(Integer attr3) {
this.attr3 = attr3;
}
public String getAttr3()
{
return attr3;
}
public void setAttr4(String attr4)
{
this.attr4 = attr4;
public Integer getAttr4() {
return attr4;
}
public String getAttr4()
{
return attr4;
public void setAttr4(Integer attr4) {
this.attr4 = attr4;
}
public List<BaseKnife> getBaseKnifeList() {
@ -119,19 +123,15 @@ public class UcmCtBase extends BaseEntity
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("ctBaseId", getCtBaseId())
.append("code", getCode())
.append("type", getType())
.append("remark", getRemark())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
return "UcmCtBase{" +
"ctBaseId='" + ctBaseId + '\'' +
", code='" + code + '\'' +
", type='" + type + '\'' +
", attr1='" + attr1 + '\'' +
", attr2='" + attr2 + '\'' +
", attr3=" + attr3 +
", attr4=" + attr4 +
", baseKnifeList=" + baseKnifeList +
'}';
}
}

View File

@ -1,162 +1,179 @@
package com.ktg.mes.wm.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
/**
* 库位设置对象 wm_storage_area
*
*
* @author yinjinlu
* @date 2022-05-08
*/
public class WmStorageArea extends BaseEntity
{
public class WmStorageArea extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 库位ID */
/**
* 库位ID
*/
private Long areaId;
/** 库位编码 */
/**
* 库位编码
*/
@Excel(name = "库位编码")
private String areaCode;
/** 库位名称 */
/**
* 库位名称
*/
@Excel(name = "库位名称")
private String areaName;
/** 库区ID */
/**
* 库区ID
*/
@Excel(name = "库区ID")
private Long locationId;
/** 面积 */
/**
* 面积
*/
@Excel(name = "面积")
private BigDecimal area;
/** 最大载重量 */
/**
* 最大载重量
*/
@Excel(name = "最大载重量")
private BigDecimal maxLoa;
/** 库位位置X */
/**
* 库位位置X
*/
@Excel(name = "库位位置X")
private Long positionX;
/** 库位位置y */
/**
* 库位位置y
*/
@Excel(name = "库位位置y")
private Long positionY;
/** 库位位置z */
/**
* 库位位置z
*/
@Excel(name = "库位位置z")
private Long positionZ;
/** 是否启用 */
/**
* 是否启用
*/
@Excel(name = "是否启用")
private String enableFlag;
private String frozenFlag;
/** 预留字段1 */
/**
* 预留字段1
*/
private String attr1;
/** 预留字段2 */
/**
* 预留字段2
*/
private String attr2;
/** 预留字段3 */
/**
* 预留字段3 - 为空或者0表示普通空间-1表示大空间
*/
private Long attr3;
/** 预留字段4 */
/**
* 预留字段4 - 为空或者0表示启用-1表示禁用
*/
private Long attr4;
public void setAreaId(Long areaId)
{
public void setAreaId(Long areaId) {
this.areaId = areaId;
}
public Long getAreaId()
{
public Long getAreaId() {
return areaId;
}
public void setAreaCode(String areaCode)
{
public void setAreaCode(String areaCode) {
this.areaCode = areaCode;
}
public String getAreaCode()
{
public String getAreaCode() {
return areaCode;
}
public void setAreaName(String areaName)
{
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public String getAreaName()
{
public String getAreaName() {
return areaName;
}
public void setLocationId(Long locationId)
{
public void setLocationId(Long locationId) {
this.locationId = locationId;
}
public Long getLocationId()
{
public Long getLocationId() {
return locationId;
}
public void setArea(BigDecimal area)
{
public void setArea(BigDecimal area) {
this.area = area;
}
public BigDecimal getArea()
{
public BigDecimal getArea() {
return area;
}
public void setMaxLoa(BigDecimal maxLoa)
{
public void setMaxLoa(BigDecimal maxLoa) {
this.maxLoa = maxLoa;
}
public BigDecimal getMaxLoa()
{
public BigDecimal getMaxLoa() {
return maxLoa;
}
public void setPositionX(Long positionX)
{
public void setPositionX(Long positionX) {
this.positionX = positionX;
}
public Long getPositionX()
{
public Long getPositionX() {
return positionX;
}
public void setPositionY(Long positionY)
{
public void setPositionY(Long positionY) {
this.positionY = positionY;
}
public Long getPositionY()
{
public Long getPositionY() {
return positionY;
}
public void setPositionZ(Long positionZ)
{
public void setPositionZ(Long positionZ) {
this.positionZ = positionZ;
}
public Long getPositionZ()
{
public Long getPositionZ() {
return positionZ;
}
public void setEnableFlag(String enableFlag)
{
public void setEnableFlag(String enableFlag) {
this.enableFlag = enableFlag;
}
public String getEnableFlag()
{
public String getEnableFlag() {
return enableFlag;
}
@ -168,65 +185,60 @@ public class WmStorageArea extends BaseEntity
this.frozenFlag = frozenFlag;
}
public void setAttr1(String attr1)
{
public void setAttr1(String attr1) {
this.attr1 = attr1;
}
public String getAttr1()
{
public String getAttr1() {
return attr1;
}
public void setAttr2(String attr2)
{
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
public String getAttr2()
{
public String getAttr2() {
return attr2;
}
public void setAttr3(Long attr3)
{
public void setAttr3(Long attr3) {
this.attr3 = attr3;
}
public Long getAttr3()
{
public Long getAttr3() {
return attr3;
}
public void setAttr4(Long attr4)
{
public void setAttr4(Long attr4) {
this.attr4 = attr4;
}
public Long getAttr4()
{
public Long getAttr4() {
return attr4;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("areaId", getAreaId())
.append("areaCode", getAreaCode())
.append("areaName", getAreaName())
.append("locationId", getLocationId())
.append("area", getArea())
.append("maxLoa", getMaxLoa())
.append("positionX", getPositionX())
.append("positionY", getPositionY())
.append("positionZ", getPositionZ())
.append("enableFlag", getEnableFlag())
.append("remark", getRemark())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("areaId", getAreaId())
.append("areaCode", getAreaCode())
.append("areaName", getAreaName())
.append("locationId", getLocationId())
.append("area", getArea())
.append("maxLoa", getMaxLoa())
.append("positionX", getPositionX())
.append("positionY", getPositionY())
.append("positionZ", getPositionZ())
.append("enableFlag", getEnableFlag())
.append("remark", getRemark())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -1,5 +1,7 @@
package com.ktg.mes.wm.domain;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
@ -13,6 +15,8 @@ import java.util.List;
* @author yinjinlu
* @date 2024-11-01
*/
@Setter
@Getter
public class WmsInTask extends BaseEntity {
private static final long serialVersionUID = 1L;
@ -139,208 +143,10 @@ public class WmsInTask extends BaseEntity {
*/
private String planTypeCode;
private String boxRfid;
private List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList;
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setTaskInCode(String taskInCode) {
this.taskInCode = taskInCode;
}
public String getTaskInCode() {
return taskInCode;
}
public void setPlanInId(Long planInId) {
this.planInId = planInId;
}
public Long getPlanInId() {
return planInId;
}
public void setTaskInQuantity(Integer taskInQuantity) {
this.taskInQuantity = taskInQuantity;
}
public Integer getTaskInQuantity() {
return taskInQuantity;
}
public void setActualInQuantity(Integer actualInQuantity) {
this.actualInQuantity = actualInQuantity;
}
public Integer getActualInQuantity() {
return actualInQuantity;
}
public void setCellTgt(Long cellTgt) {
this.cellTgt = cellTgt;
}
public Long getCellTgt() {
return cellTgt;
}
public void setCellOrig(String cellOrig) {
this.cellOrig = cellOrig;
}
public String getCellOrig() {
return cellOrig;
}
public String getCellName() {
return cellName;
}
public void setCellName(String cellName) {
this.cellName = cellName;
}
public String getCellCode() {
return cellCode;
}
public void setCellCode(String cellCode) {
this.cellCode = cellCode;
}
public String getCellX() {
return cellX;
}
public void setCellX(String cellX) {
this.cellX = cellX;
}
public String getCellY() {
return cellY;
}
public void setCellY(String cellY) {
this.cellY = cellY;
}
public String getCellZ() {
return cellZ;
}
public void setCellZ(String cellZ) {
this.cellZ = cellZ;
}
public void setIsActive(String isActive) {
this.isActive = isActive;
}
public String getIsActive() {
return isActive;
}
public void setIsDelete(String isDelete) {
this.isDelete = isDelete;
}
public String getIsDelete() {
return isDelete;
}
public void setBatch(String batch) {
this.batch = batch;
}
public String getBatch() {
return batch;
}
public void setMaterialId(String materialId) {
this.materialId = materialId;
}
public String getMaterialId() {
return materialId;
}
public void setPlanTypeId(String planTypeId) {
this.planTypeId = planTypeId;
}
public String getPlanTypeId() {
return planTypeId;
}
public void setPlanInStatus(String planInStatus) {
this.planInStatus = planInStatus;
}
public String getPlanInStatus() {
return planInStatus;
}
public void setPlanInCode(String planInCode) {
this.planInCode = planInCode;
}
public String getPlanInCode() {
return planInCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialCode() {
return materialCode;
}
public Long getDetailInId() {
return detailInId;
}
public void setDetailInId(Long detailInId) {
this.detailInId = detailInId;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getMaterialUnit() {
return materialUnit;
}
public void setMaterialUnit(String materialUnit) {
this.materialUnit = materialUnit;
}
public List<WmsInPlanDetailEntity> getWmsInPlanDetailEntityList() {
return wmsInPlanDetailEntityList;
}
public void setWmsInPlanDetailEntityList(List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList) {
this.wmsInPlanDetailEntityList = wmsInPlanDetailEntityList;
}
public String getPlanTypeCode() {
return planTypeCode;
}
public void setPlanTypeCode(String planTypeCode) {
this.planTypeCode = planTypeCode;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -2,6 +2,7 @@ package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.ProductionArrangements;
import org.apache.ibatis.annotations.Mapper;
/**
* 生产准备记录Mapper接口
@ -9,6 +10,7 @@ import com.ktg.mes.wm.domain.ProductionArrangements;
* @author yinjinlu
* @date 2024-11-18
*/
@Mapper
public interface ProductionArrangementsMapper
{
/**

View File

@ -73,4 +73,6 @@ public interface UcmCtBaseMapper
public int deleteUcmCtBaseByCtBaseIds(String[] ctBaseIds);
void deleteUcmCtMaterialByCtBaseId(String ctBaseId);
List<String> selectNotEmptyAreaIdList();
}

View File

@ -1,6 +1,8 @@
package com.ktg.mes.wm.service;
import java.util.List;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.WmStorageLocation;
import com.ktg.mes.wm.domain.vo.WmStorageLocationVo;
@ -105,4 +107,13 @@ public interface IWmStorageLocationService
* @return
*/
public int deleteByWarehouseId(Long warehouseId);
/**
* 查询一个库位
*
* @param code 库区编码
* @param isBig 是否大件
* @return 库位
*/
WmStorageArea queryOneAreaByLocationCode(String code, Boolean isBig);
}

View File

@ -145,7 +145,7 @@ public class UcmCtBaseServiceImpl implements IUcmCtBaseService {
BaseKnife baseKnifeQuery = new BaseKnife();
baseKnifeQuery.setRfid(itemCode);
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeList(baseKnifeQuery);
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeNotValidList(baseKnifeQuery);
if (baseKnifeList.isEmpty())
throw new RuntimeException("绑定失败,该物料不存在");

View File

@ -1,39 +1,50 @@
package com.ktg.mes.wm.service.impl;
import java.util.List;
import com.ktg.common.constant.UserConstants;
import com.ktg.common.utils.DateUtils;
import com.ktg.common.utils.StringUtils;
import com.ktg.mes.md.mapper.BaseKnifeMapper;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.WmStorageLocation;
import com.ktg.mes.wm.domain.vo.WmStorageLocationVo;
import org.apache.catalina.User;
import com.ktg.mes.wm.mapper.UcmCtBaseMapper;
import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
import com.ktg.mes.wm.mapper.WmStorageLocationMapper;
import com.ktg.mes.wm.service.IWmStorageLocationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktg.mes.wm.mapper.WmStorageLocationMapper;
import com.ktg.mes.wm.domain.WmStorageLocation;
import com.ktg.mes.wm.service.IWmStorageLocationService;
import java.util.List;
import java.util.stream.Collectors;
/**
* 库区设置Service业务层处理
*
*
* @author yinjinlu
* @date 2022-05-07
*/
@Service
public class WmStorageLocationServiceImpl implements IWmStorageLocationService
{
public class WmStorageLocationServiceImpl implements IWmStorageLocationService {
@Autowired
private WmStorageLocationMapper wmStorageLocationMapper;
@Autowired
private BaseKnifeMapper baseKnifeMapper;
@Autowired
private WmStorageAreaMapper wmStorageAreaMapper;
@Autowired
private UcmCtBaseMapper ucmCtBaseMapper;
/**
* 查询库区设置
*
*
* @param locationId 库区设置主键
* @return 库区设置
*/
@Override
public WmStorageLocation selectWmStorageLocationByLocationId(Long locationId)
{
public WmStorageLocation selectWmStorageLocationByLocationId(Long locationId) {
return wmStorageLocationMapper.selectWmStorageLocationByLocationId(locationId);
}
@ -44,10 +55,10 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
* @return 库区设置
*/
@Override
public WmStorageLocationVo selectWmStorageLocationVoByLocationId(Long locationId)
{
public WmStorageLocationVo selectWmStorageLocationVoByLocationId(Long locationId) {
return wmStorageLocationMapper.selectWmStorageLocationByVoLocationId(locationId);
}
@Override
public WmStorageLocation selectWmStorageLocationByLocationCode(String locationCode) {
return wmStorageLocationMapper.selectWmStorageLocationByLocationCode(locationCode);
@ -55,13 +66,12 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
/**
* 查询库区设置列表
*
*
* @param wmStorageLocation 库区设置
* @return 库区设置
*/
@Override
public List<WmStorageLocation> selectWmStorageLocationList(WmStorageLocation wmStorageLocation)
{
public List<WmStorageLocation> selectWmStorageLocationList(WmStorageLocation wmStorageLocation) {
return wmStorageLocationMapper.selectWmStorageLocationList(wmStorageLocation);
}
@ -72,16 +82,15 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
* @return 库区设置
*/
@Override
public List<WmStorageLocationVo> selectWmStorageLocationListVo(WmStorageLocation wmStorageLocation)
{
public List<WmStorageLocationVo> selectWmStorageLocationListVo(WmStorageLocation wmStorageLocation) {
return wmStorageLocationMapper.selectWmStorageLocationListVo(wmStorageLocation);
}
@Override
public String checkLocationCodeUnique(WmStorageLocation wmStorageLocation) {
WmStorageLocation location = wmStorageLocationMapper.checkLocationCodeUnique(wmStorageLocation);
Long locationId = wmStorageLocation.getLocationId()==null?-1L:wmStorageLocation.getLocationId();
if(StringUtils.isNotNull(location) && location.getLocationId().longValue() != locationId.longValue()){
Long locationId = wmStorageLocation.getLocationId() == null ? -1L : wmStorageLocation.getLocationId();
if (StringUtils.isNotNull(location) && location.getLocationId().longValue() != locationId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
@ -90,8 +99,8 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
@Override
public String checkLocationNameUnique(WmStorageLocation wmStorageLocation) {
WmStorageLocation location = wmStorageLocationMapper.checkLocationNameUnique(wmStorageLocation);
Long locationId = wmStorageLocation.getLocationId()==null?-1L:wmStorageLocation.getLocationId();
if(StringUtils.isNotNull(location) && location.getLocationId().longValue() != locationId.longValue()){
Long locationId = wmStorageLocation.getLocationId() == null ? -1L : wmStorageLocation.getLocationId();
if (StringUtils.isNotNull(location) && location.getLocationId().longValue() != locationId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
@ -99,51 +108,47 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
/**
* 新增库区设置
*
*
* @param wmStorageLocation 库区设置
* @return 结果
*/
@Override
public int insertWmStorageLocation(WmStorageLocation wmStorageLocation)
{
public int insertWmStorageLocation(WmStorageLocation wmStorageLocation) {
wmStorageLocation.setCreateTime(DateUtils.getNowDate());
return wmStorageLocationMapper.insertWmStorageLocation(wmStorageLocation);
}
/**
* 修改库区设置
*
*
* @param wmStorageLocation 库区设置
* @return 结果
*/
@Override
public int updateWmStorageLocation(WmStorageLocation wmStorageLocation)
{
public int updateWmStorageLocation(WmStorageLocation wmStorageLocation) {
wmStorageLocation.setUpdateTime(DateUtils.getNowDate());
return wmStorageLocationMapper.updateWmStorageLocation(wmStorageLocation);
}
/**
* 批量删除库区设置
*
*
* @param locationIds 需要删除的库区设置主键
* @return 结果
*/
@Override
public int deleteWmStorageLocationByLocationIds(Long[] locationIds)
{
public int deleteWmStorageLocationByLocationIds(Long[] locationIds) {
return wmStorageLocationMapper.deleteWmStorageLocationByLocationIds(locationIds);
}
/**
* 删除库区设置信息
*
*
* @param locationId 库区设置主键
* @return 结果
*/
@Override
public int deleteWmStorageLocationByLocationId(Long locationId)
{
public int deleteWmStorageLocationByLocationId(Long locationId) {
return wmStorageLocationMapper.deleteWmStorageLocationByLocationId(locationId);
}
@ -151,4 +156,30 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
public int deleteByWarehouseId(Long warehouseId) {
return wmStorageLocationMapper.deleteByWarehouseId(warehouseId);
}
@Override
public WmStorageArea queryOneAreaByLocationCode(String code, Boolean isBig) {
// 获取库区
WmStorageLocation wmStorageLocationByCode = this.wmStorageLocationMapper.selectWmStorageLocationByLocationCode(code);
if (wmStorageLocationByCode == null) throw new RuntimeException("自动获取库位失败,该库区不存在");
// 获取料箱中已经使用的库位编码
List<String> selectNotEmptyAreaIdList = this.ucmCtBaseMapper.selectNotEmptyAreaIdList();
// 获取库位列表
WmStorageArea wmStorageAreaQuery = new WmStorageArea();
wmStorageAreaQuery.setLocationId(wmStorageLocationByCode.getLocationId());
wmStorageAreaQuery.setAttr3(isBig ? 1L : 0L);
List<WmStorageArea> wmStorageAreaList = this.wmStorageAreaMapper.selectWmStorageAreaList(wmStorageAreaQuery).stream()
// 过滤掉全部已经存在料箱的库位
.filter(it -> !selectNotEmptyAreaIdList.contains(it.getAreaId().toString()))
// 过滤掉临时库位
.filter(it -> !it.getAreaCode().equals("TEMP"))
.collect(Collectors.toList());
if (wmStorageAreaList == null || wmStorageAreaList.isEmpty())
throw new RuntimeException("自动获取库位失败,无可用库位");
// 返回第一个可用的库位
return wmStorageAreaList.get(0);
}
}

View File

@ -1,26 +1,27 @@
package com.ktg.mes.wm.service.impl;
import java.util.List;
import com.ktg.common.utils.DateUtils;
import com.ktg.common.utils.StringUtils;
import com.ktg.generator.util.MultiModuleCodeGenerator;
import com.ktg.mes.md.domain.BaseKnife;
import com.ktg.mes.md.domain.MdItem;
import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.md.service.impl.BaseKnifeServiceImpl;
import com.ktg.mes.wm.domain.*;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.WmsInPlan;
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
import com.ktg.mes.wm.domain.WmsInPlanDetails;
import com.ktg.mes.wm.mapper.UcmCtBaseMapper;
import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
import com.ktg.mes.wm.mapper.WmsInPlanDetailEntityMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.ktg.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.ktg.mes.wm.mapper.WmsInPlanMapper;
import com.ktg.mes.wm.service.IWmsInPlanService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
* 入库计划Service业务层处理
@ -37,6 +38,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
private final BaseKnifeServiceImpl baseKnifeService;
private final IMdItemService mdItemService;
private final WmStorageAreaServiceImpl wmStorageAreaService;
private final WmStorageAreaMapper wmStorageAreaMapper;
/**
* 查询入库计划
@ -84,6 +86,14 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
@Transactional
@Override
public int insertWmsInPlan(WmsInPlan wmsInPlan) {
WmStorageArea wmStorageAreaByAreaCode = wmStorageAreaMapper.selectWmStorageAreaByAreaCode("TEMP");
if (wmStorageAreaByAreaCode == null) throw new RuntimeException("系统内缺少编码为“TEMP”的临时库位");
wmsInPlan.getWmsInPlanDetailsList().forEach(detail -> {
if (detail.getCellId() == null || detail.getCellId() == 0)
detail.setCellId(wmStorageAreaByAreaCode.getAreaId());
});
wmsInPlan.setCreateTime(DateUtils.getNowDate());
// 设置计划编码
if (wmsInPlan.getPlanCode() == null) {
@ -222,6 +232,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
/**
* 入库计划ID是否重复
*
* @param planCode 入库计划ID
* @return 是否重复
*/

View File

@ -62,6 +62,7 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService {
return null;
}
for (BaseKnife baseKnife : ucmCtBase.getBaseKnifeList()) {
// wmsInTaskList.clear();
WmsInPlanDetailEntity wmsInPlanDetailEntityQuery = new WmsInPlanDetailEntity();
wmsInPlanDetailEntityQuery.setRfid(baseKnife.getRfid());

View File

@ -74,6 +74,9 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
@Autowired
private ProductionArrangementsMapper productionArrangementsMapper;
@Autowired
private BaseKnifeLockedMapper baseKnifeLockedMapper;
/**
* 查询组装任务
*
@ -176,18 +179,25 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
// 查询工艺bom
BaseTechnologyBom technologyBom = new BaseTechnologyBom();
ProductionArrangements productionArrangements = new ProductionArrangements();
Boolean lockedFlag = false;
// attr4 组装任务所属计划单 如果为空则是手动组装任务不需要锁定
// 如果为空则是手动组装任务不需要锁定, 不为空说明是组装任务生成的计划单
if (zdTask.getPlanSheet() != null) {
lockedFlag = true;
// 获取工序工艺bom
BaseTechnologyBom technologyBomWrapper = new BaseTechnologyBom();
technologyBomWrapper.setProcessCode(zdTask.getProcessCode());
MdItem mdItemTemp = mdItemMapper.selectMdItemById(zdTask.getmProductId());
technologyBomWrapper.setKnifeCode(mdItemTemp.getItemCode());
technologyBom = baseTechnologyBomMapper.selectBaseTechnologyBomList(technologyBomWrapper).get(0);
// 获取生产准备记录中的锁定开始结束时间
ProductionArrangements productionArrangementsWrapper = new ProductionArrangements();
productionArrangementsWrapper.setPlanSheet(zdTask.getPlanSheet());
productionArrangements = productionArrangementsMapper.selectProductionArrangementsList(productionArrangementsWrapper).get(0);
}
// 出库基础物料 根据图号查询出库计划如果不存在生成计划存在则往计划中添加任务
// 出库基础物料 根据订单号查询出库计划如果不存在生成计划存在则往计划中添加任务
WmsOutPlan outPlan = wmsOutPlanMapper.selectWmsOutPlanByPlanCode(zdTask.getCode());
if (outPlan == null) {
// 构建新的出库计划
@ -220,15 +230,16 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
baseKnife.setKnifeLife(100);
baseKnife.setKnifeFineState(1);
baseKnife.setIsValid(1);
// 判断是否需要锁定整刀
// 判断是否需要锁定整刀来自订单的组装任务需要锁定
if (lockedFlag) {
baseKnife.setIsLocked(1);
baseKnife.setKnifeFineState(2);
baseKnife.setLockedStartTime(technologyBom.getLockedStartTime());
baseKnife.setLockedEndTime(technologyBom.getLockedEndTime());
baseKnife.setKnifeFineState(1);
baseKnife.setLockedStartTime(productionArrangements.getStartTime());
baseKnife.setLockedEndTime(productionArrangements.getEndTime());
} else {
baseKnife.setIsLocked(0);
}
// attr4 计划编码 整刀
baseKnife.setPlanSheet(zdTask.getPlanSheet());
baseKnife.setZdTaskId(zdTask.getWmsZdTaskId());
@ -237,6 +248,19 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
baseKnife.setCreateTime(DateUtils.getNowDate());
baseKnifeMapper.insertBaseKnife(baseKnife);
if (lockedFlag) {
// 添加物料锁定记录
BaseKnifeLocked baseKnifeLocked = new BaseKnifeLocked();
baseKnifeLocked.setPlanSheet(zdTask.getPlanSheet());
baseKnifeLocked.setBaseKnifeId(baseKnife.getBaseKnifeId());
baseKnifeLocked.setItemCode(mdItem.getItemCode());
baseKnifeLocked.setExpendLife(technologyBom.getExpendLife());
baseKnifeLocked.setStatus(0);
baseKnifeLocked.setLockedStartTime(productionArrangements.getStartTime());
baseKnifeLocked.setLockedEndTime(productionArrangements.getEndTime());
baseKnifeLockedMapper.insertBaseKnifeLocked(baseKnifeLocked);
}
// 锁定物料
int resetCount = 0;
for (MbbProduBom mbbProduBom : bomRoute.getMbbProduBomList()) {
@ -249,11 +273,9 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
int bomCount = mbbProduBom.getStandardDosage();
for (BaseKnife wmsBaseKnife : baseKnifeList) {
if (bomCount > 0) {
// 绑定到组装任务 整刀父id
wmsBaseKnife.setZdTaskId(zdTask.getWmsZdTaskId());
wmsBaseKnife.setIsLocked(1);
wmsBaseKnife.setKnifeFineState(2);
wmsBaseKnife.setLockedStartTime(technologyBom.getLockedStartTime());
wmsBaseKnife.setLockedEndTime(technologyBom.getLockedEndTime());
wmsBaseKnife.setParentId(baseKnife.getBaseKnifeId());
wmsBaseKnife.setPlanSheet(zdTask.getPlanSheet());
baseKnifeListOutPlan.add(wmsBaseKnife);
@ -268,6 +290,9 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
// 更新重置次数
baseKnife.setResetCount(resetCount - 1);
// 设置rfid, 为整刀编码加序号 例如整刀编码为 aaa 则整刀rfid为 aaa0001 aaa0002, 传个i在当前事务中新增的台账还没提交所以把循环系数加上
baseKnife.setRfid(this.getProductRfid(zdTask.getmProductId(), i));
baseKnifeMapper.updateBaseKnife(baseKnife);
}
@ -349,7 +374,7 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
wmsOutTask.setMdItemCode(outPlanDetail.getMdItemCode());
wmsOutTask.setMdItemName(outPlanDetail.getMdItemName());
wmsOutTask.setMdItemUnit(outPlanDetail.getMdItemUnit());
wmsOutTask.setTaskState("1");
wmsOutTask.setTaskState("0");
wmsOutTask.setRecipientUsername("");
wmsOutTask.setCreateBy(getUsername());
wmsOutTask.setCreateTime(DateUtils.getNowDate());
@ -358,11 +383,24 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
});
// 更新组装任务
zdTask.setStatus("1");
zdTask.setStatus("3");
wmsZdTaskMapper.updateWmsZdTask(zdTask);
return AjaxResult.success();
}
public String getProductRfid(Long itemId, int i){
MdItem mdItem = mdItemMapper.selectMdItemById(itemId);
// 获取最大的RFID 然后加1 RFID为物料的编码加序号
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeListByMbbBdMrlId(itemId);
if (baseKnifeList.isEmpty()) return mdItem.getItemCode() + String.format("%04d", 1);
else {
String index = baseKnifeList.get(0).getRfid().substring(baseKnifeList.get(0).getRfid().length() - 4);
Integer indexInt = Integer.parseInt(index) + 1 + i;
return mdItem.getItemCode() + String.format("%04d", indexInt);
}
}
@Override
@Transactional
@ -377,15 +415,16 @@ 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("SGLR");
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(13L);
wmsInPlanTemp.setPlanTypeId(9L);
wmsInPlanTemp.setPlanTypeCode("ZDHK");
wmsInPlanTemp.setCreateBy(getUsername());
wmsInPlanTemp.setCreateTime(DateUtils.getNowDate());
@ -403,6 +442,7 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
baseKnifeList.forEach(baseKnife -> {
WmsInPlanDetailEntity wmsInPlanDetailEntity = new WmsInPlanDetailEntity();
wmsInPlanDetailEntity.setKnifeId(baseKnife.getBaseKnifeId());
wmsInPlanDetailEntity.setRfid(baseKnife.getRfid());
wmsInPlanDetailEntityList.add(wmsInPlanDetailEntity);
});
wmsInPlanDetails.setWmsInPlanDetailEntityList(wmsInPlanDetailEntityList);
@ -425,6 +465,9 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
wmsInPlanService.updateWmsInPlan(wmsInPlan);
}
// 复查一遍入库计划
WmsInPlan inPlanTemp = wmsInPlanService.selectWmsInPlanByPlanId(wmsInPlan.getPlanId());
// 入库任务
MdItem mdItem = mdItemMapper.selectMdItemById(zdTask.getmProductId());
WmsInTask wmsInTask = new WmsInTask();
@ -440,7 +483,9 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
wmsInTask.setBatch(batchNum);
wmsInTask.setMaterialId(zdTask.getmProductId().toString());
wmsInTask.setPlanTypeId("9");
wmsInTask.setPlanInStatus("1");
wmsInTask.setPlanTypeCode("ZDHK");
wmsInTask.setPlanInStatus("0");
wmsInTask.setDetailInId(inPlanTemp.getWmsInPlanDetailsList().get(0).getDetailsId());
wmsInTask.setCreateBy(getUsername());
wmsInTask.setCreateTime(DateUtils.getNowDate());
wmsInTaskMapper.insertWmsInTask(wmsInTask);
@ -452,6 +497,7 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
return AjaxResult.success();
}
@Override
public String checkTaskCodeUnique(WmsZdTask wmsZdTask) {
WmsZdTask zdTask = wmsZdTaskMapper.checkTaskCodeUnique(wmsZdTask);

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ktg.mes.md.mapper.BaseKnifeLockedMapper">
<resultMap type="BaseKnifeLocked" id="BaseKnifeLockedResult">
<result property="baseKnifeId" column="BASE_KNIFE_ID" />
<result property="planSheet" column="PLAN_SHEET" />
<result property="itemCode" column="ITEM_CODE" />
<result property="expendLife" column="EXPEND_LIFE" />
<result property="status" column="STATUS" />
<result property="lockedStartTime" column="LOCKED_START_TIME" />
<result property="lockedEndTime" column="LOCKED_END_TIME" />
<result property="baseKnifeLockedId" column="BASE_KNIFE_LOCKED_ID" />
</resultMap>
<sql id="selectBaseKnifeLockedVo">
select BASE_KNIFE_ID, PLAN_SHEET, ITEM_CODE, EXPEND_LIFE, STATUS, LOCKED_START_TIME, LOCKED_END_TIME, BASE_KNIFE_LOCKED_ID from BASE_KNIFE_LOCKED
</sql>
<select id="selectBaseKnifeLockedList" parameterType="BaseKnifeLocked" resultMap="BaseKnifeLockedResult">
<include refid="selectBaseKnifeLockedVo"/>
<where>
<if test="baseKnifeId != null and baseKnifeId != ''"> and BASE_KNIFE_ID = #{baseKnifeId}</if>
<if test="planSheet != null and planSheet != ''"> and PLAN_SHEET = #{planSheet}</if>
<if test="itemCode != null and itemCode != ''"> and ITEM_CODE = #{itemCode}</if>
<if test="expendLife != null and expendLife != ''"> and EXPEND_LIFE = #{expendLife}</if>
<if test="status != null"> and STATUS = #{status}</if>
<if test="lockedStartTime != null and lockedStartTime != ''"> and LOCKED_START_TIME = #{lockedStartTime}</if>
<if test="lockedEndTime != null and lockedEndTime != ''"> and LOCKED_END_TIME = #{lockedEndTime}</if>
</where>
order by LOCKED_START_TIME
</select>
<select id="selectBaseKnifeLockedByBaseKnifeLockedId" parameterType="String" resultMap="BaseKnifeLockedResult">
<include refid="selectBaseKnifeLockedVo"/>
where BASE_KNIFE_LOCKED_ID = #{baseKnifeLockedId}
</select>
<insert id="insertBaseKnifeLocked" parameterType="BaseKnifeLocked" useGeneratedKeys="true" keyProperty="baseKnifeLockedId">
insert into BASE_KNIFE_LOCKED
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="baseKnifeId != null">BASE_KNIFE_ID,</if>
<if test="planSheet != null">PLAN_SHEET,</if>
<if test="itemCode != null">ITEM_CODE,</if>
<if test="expendLife != null">EXPEND_LIFE,</if>
<if test="status != null">STATUS,</if>
<if test="lockedStartTime != null">LOCKED_START_TIME,</if>
<if test="lockedEndTime != null">LOCKED_END_TIME,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="baseKnifeId != null">#{baseKnifeId},</if>
<if test="planSheet != null">#{planSheet},</if>
<if test="itemCode != null">#{itemCode},</if>
<if test="expendLife != null">#{expendLife},</if>
<if test="status != null">#{status},</if>
<if test="lockedStartTime != null">#{lockedStartTime},</if>
<if test="lockedEndTime != null">#{lockedEndTime},</if>
</trim>
</insert>
<update id="updateBaseKnifeLocked" parameterType="BaseKnifeLocked">
update BASE_KNIFE_LOCKED
<trim prefix="SET" suffixOverrides=",">
<if test="baseKnifeId != null">BASE_KNIFE_ID = #{baseKnifeId},</if>
<if test="planSheet != null">PLAN_SHEET = #{planSheet},</if>
<if test="itemCode != null">ITEM_CODE = #{itemCode},</if>
<if test="expendLife != null">EXPEND_LIFE = #{expendLife},</if>
<if test="status != null">STATUS = #{status},</if>
<if test="lockedStartTime != null">LOCKED_START_TIME = #{lockedStartTime},</if>
<if test="lockedEndTime != null">LOCKED_END_TIME = #{lockedEndTime},</if>
</trim>
where BASE_KNIFE_LOCKED_ID = #{baseKnifeLockedId}
</update>
<delete id="deleteBaseKnifeLockedByBaseKnifeLockedId" parameterType="String">
delete from BASE_KNIFE_LOCKED where BASE_KNIFE_LOCKED_ID = #{baseKnifeLockedId}
</delete>
<delete id="deleteBaseKnifeLockedByBaseKnifeLockedIds" parameterType="String">
delete from BASE_KNIFE_LOCKED where BASE_KNIFE_LOCKED_ID in
<foreach item="baseKnifeLockedId" collection="array" open="(" separator="," close=")">
#{baseKnifeLockedId}
</foreach>
</delete>
</mapper>

View File

@ -612,4 +612,22 @@
FROM BASE_KNIFE
WHERE RFID = #{value}
</select>
</mapper>
<select id="selectNotEmptyAreaCodeList" resultType="java.lang.String">
SELECT AREA_CODE
FROM BASE_KNIFE
WHERE KNIFE_FINE_STATE == 1
GROUP BY AREA_CODE
</select>
<select id="selectBaseKnifeListByMbbBdMrlId" resultType="com.ktg.mes.md.domain.BaseKnife">
<include refid="selectBaseKnifeVo"/>
<where>
IS_VALID = 0
<if test="mbbBdMrlId != null and mbbBdMrlId != ''">
and MBB_BD_MRL_ID = #{mbbBdMrlId}
</if>
</where>
order by rfid desc
</select>
</mapper>

View File

@ -52,6 +52,8 @@
high_value,
attr1,
attr2,
attr3,
attr4,
create_by,
create_time,
remark
@ -323,10 +325,10 @@
<if test="attr2 != null">
attr2=#{attr2},
</if>
<if test="attr3 != null and attr3 != 0">
<if test="attr3 != null">
attr3=#{attr3},
</if>
<if test="attr4 != null and attr4 != 0">
<if test="attr4 != null">
attr4=#{attr4},
</if>
<if test="updateBy != null and updateBy != ''">

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ktg.mes.wm.mapper.ProductionArrangementsMapper">
<resultMap type="ProductionArrangements" id="ProductionArrangementsResult">
<result property="productionArrangementsId" column="PRODUCTION_ARRANGEMENTS_ID" />
<result property="planSheet" column="PLAN_SHEET" />
<result property="processCode" column="PROCESS_CODE" />
<result property="technologyCode" column="TECHNOLOGY_CODE" />
<result property="status" column="STATUS" />
<result property="attr1" column="ATTR1" />
<result property="attr2" column="ATTR2" />
@ -17,17 +17,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="CREATE_TIME" />
<result property="updateBy" column="UPDATE_BY" />
<result property="updateTime" column="UPDATE_TIME" />
<result property="startTime" column="START_TIME" />
<result property="endTime" column="END_TIME" />
</resultMap>
<sql id="selectProductionArrangementsVo">
select PRODUCTION_ARRANGEMENTS_ID, PLAN_SHEET, PROCESS_CODE, STATUS, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME from PRODUCTION_ARRANGEMENTS
select PRODUCTION_ARRANGEMENTS_ID, PLAN_SHEET, TECHNOLOGY_CODE, STATUS, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, START_TIME, END_TIME from PRODUCTION_ARRANGEMENTS
</sql>
<select id="selectProductionArrangementsList" parameterType="ProductionArrangements" resultMap="ProductionArrangementsResult">
<include refid="selectProductionArrangementsVo"/>
<where>
<where>
<if test="planSheet != null and planSheet != ''"> and PLAN_SHEET = #{planSheet}</if>
<if test="processCode != null and processCode != ''"> and PROCESS_CODE = #{processCode}</if>
<if test="technologyCode != null and technologyCode != ''"> and TECHNOLOGY_CODE = #{technologyCode}</if>
<if test="status != null and status != ''"> and STATUS = #{status}</if>
<if test="attr1 != null and attr1 != ''"> and ATTR1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and ATTR2 = #{attr2}</if>
@ -37,9 +39,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null and createTime != ''"> and CREATE_TIME = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and UPDATE_BY = #{updateBy}</if>
<if test="updateTime != null and updateTime != ''"> and UPDATE_TIME = #{updateTime}</if>
<if test="startTime != null and startTime != ''"> and START_TIME = #{startTime}</if>
<if test="endTime != null and endTime != ''"> and END_TIME = #{endTime}</if>
</where>
</select>
<select id="selectProductionArrangementsByProductionArrangementsId" parameterType="String" resultMap="ProductionArrangementsResult">
<include refid="selectProductionArrangementsVo"/>
where PRODUCTION_ARRANGEMENTS_ID = #{productionArrangementsId}
@ -49,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectProductionArrangementsVo"/>
where PLAN_SHEET = #{planSheet}
</select>
<insert id="insertProductionArrangements" parameterType="ProductionArrangements" useGeneratedKeys="true" keyProperty="productionArrangementsId">
insert into PRODUCTION_ARRANGEMENTS
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -65,7 +69,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">CREATE_TIME,</if>
<if test="updateBy != null">UPDATE_BY,</if>
<if test="updateTime != null">UPDATE_TIME,</if>
</trim>
<if test="startTime != null">START_TIME,</if>
<if test="endTime != null">END_TIME,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="planSheet != null">#{planSheet},</if>
<if test="technologyCode != null">#{technologyCode},</if>
@ -79,7 +85,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
</trim>
</insert>
<update id="updateProductionArrangements" parameterType="ProductionArrangements">
@ -96,6 +104,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">CREATE_TIME = #{createTime},</if>
<if test="updateBy != null">UPDATE_BY = #{updateBy},</if>
<if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
<if test="startTime != null">START_TIME = #{startTime},</if>
<if test="endTime != null">END_TIME = #{endTime},</if>
</trim>
where PRODUCTION_ARRANGEMENTS_ID = #{productionArrangementsId}
</update>
@ -105,7 +115,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteProductionArrangementsByProductionArrangementsIds" parameterType="String">
delete from PRODUCTION_ARRANGEMENTS where PRODUCTION_ARRANGEMENTS_ID in
delete from PRODUCTION_ARRANGEMENTS where PRODUCTION_ARRANGEMENTS_ID in
<foreach item="productionArrangementsId" collection="array" open="(" separator="," close=")">
#{productionArrangementsId}
</foreach>

View File

@ -1,67 +1,123 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ktg.mes.wm.mapper.UcmCtBaseMapper">
<resultMap type="UcmCtBase" id="UcmCtBaseResult">
<result property="ctBaseId" column="CT_BASE_ID" />
<result property="code" column="CODE" />
<result property="type" column="TYPE" />
<result property="remark" column="REMARK" />
<result property="attr1" column="ATTR1" />
<result property="attr2" column="ATTR2" />
<result property="attr3" column="ATTR3" />
<result property="attr4" column="ATTR4" />
<result property="createBy" column="CREATE_BY" />
<result property="createTime" column="CREATE_TIME" />
<result property="updateBy" column="UPDATE_BY" />
<result property="updateTime" column="UPDATE_TIME" />
<result property="ctBaseId" column="CT_BASE_ID"/>
<result property="code" column="CODE"/>
<result property="type" column="TYPE"/>
<result property="remark" column="REMARK"/>
<result property="attr1" column="ATTR1"/>
<result property="attr2" column="ATTR2"/>
<result property="attr3" column="ATTR3"/>
<result property="attr4" column="ATTR4"/>
<result property="createBy" column="CREATE_BY"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="updateTime" column="UPDATE_TIME"/>
</resultMap>
<resultMap id="UcmCtBaseBaseKnifeResult" type="UcmCtBase" extends="UcmCtBaseResult">
<collection property="baseKnifeList" notNullColumn="base_knife_id" javaType="java.util.List" resultMap="BaseKnifeList" />
<collection property="baseKnifeList" notNullColumn="base_knife_id" javaType="java.util.List"
resultMap="BaseKnifeList"/>
</resultMap>
<resultMap type="BaseKnife" id="BaseKnifeList">
<result property="baseKnifeId" column="base_knife_id" />
<result property="knifeCode" column="knife_code" />
<result property="knifeName" column="knife_name" />
<result property="knifeUnit" column="knife_unit" />
<result property="baseKnifeId" column="base_knife_id"/>
<result property="rfid" column="rfid"/>
<result property="knifeCode" column="knife_code"/>
<result property="knifeName" column="knife_name"/>
<result property="knifeUnit" column="knife_unit"/>
</resultMap>
<sql id="selectUcmCtBaseVo">
select CT_BASE_ID, CODE, TYPE, REMARK, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME from UCM_CT_BASE
select CT_BASE_ID,
CODE,
TYPE,
REMARK,
ATTR1,
ATTR2,
ATTR3,
ATTR4,
CREATE_BY,
CREATE_TIME,
UPDATE_BY,
UPDATE_TIME
from UCM_CT_BASE
</sql>
<select id="selectUcmCtBaseList" parameterType="UcmCtBase" resultMap="UcmCtBaseResult">
<include refid="selectUcmCtBaseVo"/>
<where>
<if test="code != null and code != ''"> and CODE = #{code}</if>
<if test="type != null and type != ''"> and TYPE = #{type}</if>
<if test="createBy != null and createBy != ''"> and CREATE_BY = #{createBy}</if>
<if test="createTime != null and createTime != ''"> and CREATE_TIME = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and UPDATE_BY = #{updateBy}</if>
<if test="updateTime != null and updateTime != ''"> and UPDATE_TIME = #{updateTime}</if>
<where>
<if test="code != null and code != ''">
and CODE = #{code}
</if>
<if test="type != null and type != ''">
and TYPE = #{type}
</if>
<if test="attr1 != null">
and ATTR1 = #{attr1}
</if>
<if test="attr3 != null">
and ATTR3 = #{attr3}
</if>
<if test="createBy != null and createBy != ''">
and CREATE_BY = #{createBy}
</if>
<if test="createTime != null and createTime != ''">
and CREATE_TIME = #{createTime}
</if>
<if test="updateBy != null and updateBy != ''">
and UPDATE_BY = #{updateBy}
</if>
<if test="updateTime != null and updateTime != ''">
and UPDATE_TIME = #{updateTime}
</if>
</where>
</select>
<select id="selectUcmCtBaseByCode" parameterType="String" resultMap="UcmCtBaseBaseKnifeResult">
select ucb.CT_BASE_ID, ucb.CODE, ucb.TYPE, ucb.REMARK, ucb.CREATE_BY, ucb.CREATE_TIME, ucb.UPDATE_BY, ucb.UPDATE_TIME,
bk.base_knife_id, mi.item_name as knife_name, mi.item_code as knife_code, mi.unit_name as knife_unit
select ucb.CT_BASE_ID,
ucb.CODE,
ucb.TYPE,
ucb.REMARK,
ucb.ATTR1,
ucb.ATTR3,
ucb.CREATE_BY,
ucb.CREATE_TIME,
ucb.UPDATE_BY,
ucb.UPDATE_TIME,
bk.base_knife_id,
bk.rfid,
mi.item_name as knife_name,
mi.item_code as knife_code,
mi.unit_name as knife_unit
from UCM_CT_BASE ucb
left join ucm_ct_material ucm
on ucb.ct_base_id = ucm.ct_base_id
left join base_knife bk
on ucm.base_knife_id = bk.base_knife_id
left join md_item mi
on bk.mbb_bd_mrl_id = mi.item_id
left join ucm_ct_material ucm
on ucb.ct_base_id = ucm.ct_base_id
left join base_knife bk
on ucm.base_knife_id = bk.base_knife_id
left join md_item mi
on bk.mbb_bd_mrl_id = mi.item_id
where ucb.CODE = #{code}
</select>
<select id="selectUcmCtBaseByCtBaseId" parameterType="String" resultMap="UcmCtBaseBaseKnifeResult">
select ucb.CT_BASE_ID, ucb.CODE, ucb.TYPE, ucb.REMARK, ucb.CREATE_BY, ucb.CREATE_TIME, ucb.UPDATE_BY, ucb.UPDATE_TIME,
bk.base_knife_id, mi.item_name as knife_name, mi.item_code as knife_code, mi.unit_name as knife_unit
select ucb.CT_BASE_ID,
ucb.CODE,
ucb.TYPE,
ucb.REMARK,
ucb.ATTR1,
ucb.ATTR3,
ucb.CREATE_BY,
ucb.CREATE_TIME,
ucb.UPDATE_BY,
ucb.UPDATE_TIME,
bk.base_knife_id,
mi.item_name as knife_name,
mi.item_code as knife_code,
mi.unit_name as knife_unit
from UCM_CT_BASE ucb
left join ucm_ct_material ucm
on ucb.ct_base_id = ucm.ct_base_id
@ -71,72 +127,147 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
on bk.mbb_bd_mrl_id = mi.item_id
where ucb.CT_BASE_ID = #{ctBaseId}
</select>
<insert id="insertUcmCtBase" parameterType="UcmCtBase" useGeneratedKeys="true" keyProperty="ctBaseId">
insert into UCM_CT_BASE
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null">CODE,</if>
<if test="type != null">TYPE,</if>
<if test="remark != null">REMARK,</if>
<if test="attr1 != null">ATTR1,</if>
<if test="attr2 != null">ATTR2,</if>
<if test="attr3 != null">ATTR3,</if>
<if test="attr4 != null">ATTR4,</if>
<if test="createBy != null">CREATE_BY,</if>
<if test="createTime != null">CREATE_TIME,</if>
<if test="updateBy != null">UPDATE_BY,</if>
<if test="updateTime != null">UPDATE_TIME,</if>
</trim>
<if test="code != null">
CODE,
</if>
<if test="type != null">
TYPE,
</if>
<if test="remark != null">
REMARK,
</if>
<if test="attr1 != null">
ATTR1,
</if>
<if test="attr2 != null">
ATTR2,
</if>
<if test="attr3 != null">
ATTR3,
</if>
<if test="attr4 != null">
ATTR4,
</if>
<if test="createBy != null">
CREATE_BY,
</if>
<if test="createTime != null">
CREATE_TIME,
</if>
<if test="updateBy != null">
UPDATE_BY,
</if>
<if test="updateTime != null">
UPDATE_TIME,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null">#{code},</if>
<if test="type != null">#{type},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
<if test="code != null">
#{code},
</if>
<if test="type != null">
#{type},
</if>
<if test="remark != null">
#{remark},
</if>
<if test="attr1 != null">
#{attr1},
</if>
<if test="attr2 != null">
#{attr2},
</if>
<if test="attr3 != null">
#{attr3},
</if>
<if test="attr4 != null">
#{attr4},
</if>
<if test="createBy != null">
#{createBy},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateBy != null">
#{updateBy},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
</trim>
</insert>
<update id="updateUcmCtBase" parameterType="UcmCtBase">
update UCM_CT_BASE
<trim prefix="SET" suffixOverrides=",">
<if test="code != null">CODE = #{code},</if>
<if test="type != null">TYPE = #{type},</if>
<if test="remark != null">REMARK = #{remark},</if>
<if test="attr1 != null">ATTR1 = #{attr1},</if>
<if test="attr2 != null">ATTR2 = #{attr2},</if>
<if test="attr3 != null">ATTR3 = #{attr3},</if>
<if test="attr4 != null">ATTR4 = #{attr4},</if>
<if test="createBy != null">CREATE_BY = #{createBy},</if>
<if test="createTime != null">CREATE_TIME = #{createTime},</if>
<if test="updateBy != null">UPDATE_BY = #{updateBy},</if>
<if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
<if test="code != null">
CODE = #{code},
</if>
<if test="type != null">
TYPE = #{type},
</if>
<if test="remark != null">
REMARK = #{remark},
</if>
ATTR1 = #{attr1},
<if test="attr2 != null">
ATTR2 = #{attr2},
</if>
<if test="attr3 != null">
ATTR3 = #{attr3},
</if>
<if test="attr4 != null">
ATTR4 = #{attr4},
</if>
<if test="createBy != null">
CREATE_BY = #{createBy},
</if>
<if test="createTime != null">
CREATE_TIME = #{createTime},
</if>
<if test="updateBy != null">
UPDATE_BY = #{updateBy},
</if>
<if test="updateTime != null">
UPDATE_TIME = #{updateTime},
</if>
</trim>
where CT_BASE_ID = #{ctBaseId}
</update>
<delete id="deleteUcmCtBaseByCtBaseId" parameterType="String">
delete from UCM_CT_BASE where CT_BASE_ID = #{ctBaseId}
delete
from UCM_CT_BASE
where CT_BASE_ID = #{ctBaseId}
</delete>
<delete id="deleteUcmCtBaseByCtBaseIds" parameterType="String">
delete from UCM_CT_BASE where CT_BASE_ID in
delete
from UCM_CT_BASE where CT_BASE_ID in
<foreach item="ctBaseId" collection="array" open="(" separator="," close=")">
#{ctBaseId}
</foreach>
</delete>
<delete id="deleteUcmCtMaterialByCtBaseId">
delete from UCM_CT_MATERIAL where ct_base_id = #{ctBaseId}
delete
from UCM_CT_MATERIAL
where ct_base_id = #{ctBaseId}
</delete>
<insert id="insertUcmCtMaterial">
insert into ucm_ct_material( ct_base_id, base_knife_id, CREATE_BY, CREATE_TIME) values
( #{ctBaseId}, #{baseKnifeId}, #{createBy}, #{createTime})
insert into ucm_ct_material(ct_base_id, base_knife_id, CREATE_BY, CREATE_TIME)
values (#{ctBaseId}, #{baseKnifeId}, #{createBy}, #{createTime})
</insert>
</mapper>
<select id="selectNotEmptyAreaIdList" resultType="java.lang.String">
SELECT ATTR1
FROM UCM_CT_BASE
GROUP BY ATTR1
</select>
</mapper>

View File

@ -1,189 +1,373 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ktg.mes.wm.mapper.WmStorageAreaMapper">
<resultMap type="WmStorageArea" id="WmStorageAreaResult">
<result property="areaId" column="area_id" />
<result property="areaCode" column="area_code" />
<result property="areaName" column="area_name" />
<result property="locationId" column="location_id" />
<result property="area" column="area" />
<result property="maxLoa" column="max_loa" />
<result property="positionX" column="position_x" />
<result property="positionY" column="position_y" />
<result property="positionZ" column="position_z" />
<result property="enableFlag" column="enable_flag" />
<result property="frozenFlag" column="frozen_flag" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="areaId" column="area_id"/>
<result property="areaCode" column="area_code"/>
<result property="areaName" column="area_name"/>
<result property="locationId" column="location_id"/>
<result property="area" column="area"/>
<result property="maxLoa" column="max_loa"/>
<result property="positionX" column="position_x"/>
<result property="positionY" column="position_y"/>
<result property="positionZ" column="position_z"/>
<result property="enableFlag" column="enable_flag"/>
<result property="frozenFlag" column="frozen_flag"/>
<result property="remark" column="remark"/>
<result property="attr1" column="attr1"/>
<result property="attr2" column="attr2"/>
<result property="attr3" column="attr3"/>
<result property="attr4" column="attr4"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<resultMap type="AreaVo" id="WmStorageAreaVoResult">
<result property="areaId" column="area_id" />
<result property="areaCode" column="area_code" />
<result property="locationName" column="location_name" />
<result property="areaName" column="area_name" />
<result property="locationId" column="location_id" />
<result property="area" column="area" />
<result property="maxLoa" column="max_loa" />
<result property="positionX" column="position_x" />
<result property="positionY" column="position_y" />
<result property="positionZ" column="position_z" />
<result property="enableFlag" column="enable_flag" />
<result property="frozenFlag" column="frozen_flag" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="areaId" column="area_id"/>
<result property="areaCode" column="area_code"/>
<result property="locationName" column="location_name"/>
<result property="areaName" column="area_name"/>
<result property="locationId" column="location_id"/>
<result property="area" column="area"/>
<result property="maxLoa" column="max_loa"/>
<result property="positionX" column="position_x"/>
<result property="positionY" column="position_y"/>
<result property="positionZ" column="position_z"/>
<result property="enableFlag" column="enable_flag"/>
<result property="frozenFlag" column="frozen_flag"/>
<result property="remark" column="remark"/>
<result property="attr1" column="attr1"/>
<result property="attr2" column="attr2"/>
<result property="attr3" column="attr3"/>
<result property="attr4" column="attr4"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectWmStorageAreaVo">
select area_id, area_code, area_name, location_id, area, max_loa, position_x, position_y, position_z, enable_flag, frozen_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_storage_area
select area_id,
area_code,
area_name,
location_id,
area,
max_loa,
position_x,
position_y,
position_z,
enable_flag,
frozen_flag,
remark,
attr1,
attr2,
attr3,
attr4,
create_by,
create_time,
update_by,
update_time
from wm_storage_area
</sql>
<select id="selectWmStorageAreaList" parameterType="WmStorageArea" resultMap="WmStorageAreaResult">
<include refid="selectWmStorageAreaVo"/>
<where>
<if test="areaCode != null and areaCode != ''"> and area_code like concat('%', #{areaCode}, '%') </if>
<if test="areaName != null and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
<if test="locationId != null "> and location_id like concat('%', #{locationId}, '%') </if>
<if test="area != null "> and like concat('%',#{area}, '%') </if>
<if test="maxLoa != null "> and max_loa = #{maxLoa}</if>
<if test="positionX != null and positionX !=0 "> and position_x = #{positionX}</if>
<if test="positionY != null and positionY !=0"> and position_y = #{positionY}</if>
<if test="positionZ != null and positionZ !=0"> and position_z = #{positionZ}</if>
<if test="enableFlag != null and enableFlag != ''"> and enable_flag = #{enableFlag}</if>
and IS_DELETE = 0
</where>
</select>
<select id="selectWmStorageAreaList" parameterType="WmStorageArea" resultMap="WmStorageAreaResult">
<include refid="selectWmStorageAreaVo"/>
<where>
<if test="areaCode != null and areaCode != ''">
and area_code like concat('%', #{areaCode}, '%')
</if>
<if test="areaName != null and areaName != ''">
and area_name like concat('%', #{areaName}, '%')
</if>
<if test="locationId != null">
and location_id like concat('%', #{locationId}, '%')
</if>
<if test="area != null">
and like concat('%', #{area}, '%')
</if>
<if test="maxLoa != null">
and max_loa = #{maxLoa}
</if>
<if test="attr3 != null">
and attr3 = #{attr3}
</if>
<if test="positionX != null and positionX != 0">
and position_x = #{positionX}
</if>
<if test="positionY != null and positionY != 0">
and position_y = #{positionY}
</if>
<if test="positionZ != null and positionZ != 0">
and position_z = #{positionZ}
</if>
<if test="enableFlag != null and enableFlag != ''">
and enable_flag = #{enableFlag}
</if>
and IS_DELETE = 0
</where>
ORDER BY AREA_CODE ASC
</select>
<select id="selectWmStorageAreaListVo" parameterType="AreaVo" resultMap="WmStorageAreaVoResult">
select w.*,l.location_name from wm_storage_area w join wm_storage_location l on w.location_id = l.location_id
select w.*, l.location_name
from wm_storage_area w
join wm_storage_location l on w.location_id = l.location_id
<where>
<if test="areaCode != null and areaCode != ''"> and w.area_code like concat('%', #{areaCode}, '%') </if>
<if test="areaName != null and areaName != ''"> and w.area_name like concat('%', #{areaName}, '%')</if>
<if test="locationId != null "> and w.location_id like concat('%', #{locationId}, '%') </if>
<if test="area != null "> and like concat('%',#{area}, '%') </if>
<if test="maxLoa != null "> and max_loa = #{maxLoa}</if>
<if test="positionX != null and positionX !=0 "> and w.position_x = #{positionX}</if>
<if test="positionY != null and positionY !=0"> and w.position_y = #{positionY}</if>
<if test="positionZ != null and positionZ !=0"> and w.position_z = #{positionZ}</if>
<if test="enableFlag != null and enableFlag != ''"> and w.enable_flag = #{enableFlag}</if>
<if test="areaCode != null and areaCode != ''">
and w.area_code like concat('%', #{areaCode}, '%')
</if>
<if test="areaName != null and areaName != ''">
and w.area_name like concat('%', #{areaName}, '%')
</if>
<if test="locationId != null">
and w.location_id like concat('%', #{locationId}, '%')
</if>
<if test="area != null">
and like concat('%', #{area}, '%')
</if>
<if test="maxLoa != null">
and max_loa = #{maxLoa}
</if>
<if test="positionX != null and positionX != 0">
and w.position_x = #{positionX}
</if>
<if test="positionY != null and positionY != 0">
and w.position_y = #{positionY}
</if>
<if test="positionZ != null and positionZ != 0">
and w.position_z = #{positionZ}
</if>
<if test="enableFlag != null and enableFlag != ''">
and w.enable_flag = #{enableFlag}
</if>
and w.IS_DELETE = 0
</where>
</select>
<select id="selectWmStorageAreaByAreaId" parameterType="Long" resultMap="WmStorageAreaResult">
<include refid="selectWmStorageAreaVo"/>
where area_id = #{areaId} and IS_DELETE = 0
where area_id = #{areaId}
and IS_DELETE = 0
</select>
<select id="selectWmStorageAreaByAreaIdVo" parameterType="Long" resultMap="WmStorageAreaVoResult">
select w.*,l.location_name from wm_storage_area w join wm_storage_location l on w.location_id = l.location_id
where area_id = #{areaId} and w.IS_DELETE = 0
select w.*, l.location_name
from wm_storage_area w
join wm_storage_location l on w.location_id = l.location_id
where area_id = #{areaId}
and w.IS_DELETE = 0
</select>
<select id="selectWmStorageAreaByAreaCode" parameterType="String" resultMap="WmStorageAreaResult">
<include refid="selectWmStorageAreaVo"/>
where area_code = #{areaCode} and IS_DELETE = 0
where area_code = #{areaCode}
and IS_DELETE = 0
</select>
<select id="getAll" resultType="com.ktg.mes.wm.domain.WmStorageArea" resultMap="WmStorageAreaResult">
SELECT * FROM wm_storage_area where IS_DELETE = 0
SELECT *
FROM wm_storage_area
where IS_DELETE = 0
</select>
<insert id="insertWmStorageArea" parameterType="WmStorageArea" useGeneratedKeys="true" keyProperty="areaId">
insert into wm_storage_area
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="areaCode != null and areaCode != ''">area_code,</if>
<if test="areaName != null and areaName != ''">area_name,</if>
<if test="locationId != null">location_id,</if>
<if test="area != null">area,</if>
<if test="maxLoa != null">max_loa,</if>
<if test="positionX != null">position_x,</if>
<if test="positionY != null">position_y,</if>
<if test="positionZ != null">position_z,</if>
<if test="enableFlag != null">enable_flag,</if>
<if test="frozenFlag != null">frozen_flag,</if>
<if test="remark != null">remark,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="attr4 != null">attr4,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<if test="areaCode != null and areaCode != ''">
area_code,
</if>
<if test="areaName != null and areaName != ''">
area_name,
</if>
<if test="locationId != null">
location_id,
</if>
<if test="area != null">
area,
</if>
<if test="maxLoa != null">
max_loa,
</if>
<if test="positionX != null">
position_x,
</if>
<if test="positionY != null">
position_y,
</if>
<if test="positionZ != null">
position_z,
</if>
<if test="enableFlag != null">
enable_flag,
</if>
<if test="frozenFlag != null">
frozen_flag,
</if>
<if test="remark != null">
remark,
</if>
<if test="attr1 != null">
attr1,
</if>
<if test="attr2 != null">
attr2,
</if>
<if test="attr3 != null">
attr3,
</if>
<if test="attr4 != null">
attr4,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateBy != null">
update_by,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="areaCode != null and areaCode != ''">#{areaCode},</if>
<if test="areaName != null and areaName != ''">#{areaName},</if>
<if test="locationId != null">#{locationId},</if>
<if test="area != null">#{area},</if>
<if test="maxLoa != null">#{maxLoa},</if>
<if test="positionX != null">#{positionX},</if>
<if test="positionY != null">#{positionY},</if>
<if test="positionZ != null">#{positionZ},</if>
<if test="enableFlag != null">#{enableFlag},</if>
<if test="frozenFlag != null">#{frozenFlag},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
<if test="areaCode != null and areaCode != ''">
#{areaCode},
</if>
<if test="areaName != null and areaName != ''">
#{areaName},
</if>
<if test="locationId != null">
#{locationId},
</if>
<if test="area != null">
#{area},
</if>
<if test="maxLoa != null">
#{maxLoa},
</if>
<if test="positionX != null">
#{positionX},
</if>
<if test="positionY != null">
#{positionY},
</if>
<if test="positionZ != null">
#{positionZ},
</if>
<if test="enableFlag != null">
#{enableFlag},
</if>
<if test="frozenFlag != null">
#{frozenFlag},
</if>
<if test="remark != null">
#{remark},
</if>
<if test="attr1 != null">
#{attr1},
</if>
<if test="attr2 != null">
#{attr2},
</if>
<if test="attr3 != null">
#{attr3},
</if>
<if test="attr4 != null">
#{attr4},
</if>
<if test="createBy != null">
#{createBy},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateBy != null">
#{updateBy},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
</trim>
</insert>
<update id="updateWmStorageArea" parameterType="WmStorageArea">
update wm_storage_area
<trim prefix="SET" suffixOverrides=",">
<if test="areaCode != null and areaCode != ''">area_code = #{areaCode},</if>
<if test="areaName != null and areaName != ''">area_name = #{areaName},</if>
<if test="locationId != null">location_id = #{locationId},</if>
<if test="area != null">area = #{area},</if>
<if test="maxLoa != null">max_loa = #{maxLoa},</if>
<if test="positionX != null">position_x = #{positionX},</if>
<if test="positionY != null">position_y = #{positionY},</if>
<if test="positionZ != null">position_z = #{positionZ},</if>
<if test="enableFlag != null">enable_flag = #{enableFlag},</if>
<if test="frozenFlag != null">frozen_flag = #{frozenFlag},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="attr4 != null">attr4 = #{attr4},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="areaCode != null and areaCode != ''">
area_code = #{areaCode},
</if>
<if test="areaName != null and areaName != ''">
area_name = #{areaName},
</if>
<if test="locationId != null">
location_id = #{locationId},
</if>
<if test="area != null">
area = #{area},
</if>
<if test="maxLoa != null">
max_loa = #{maxLoa},
</if>
<if test="positionX != null">
position_x = #{positionX},
</if>
<if test="positionY != null">
position_y = #{positionY},
</if>
<if test="positionZ != null">
position_z = #{positionZ},
</if>
<if test="enableFlag != null">
enable_flag = #{enableFlag},
</if>
<if test="frozenFlag != null">
frozen_flag = #{frozenFlag},
</if>
<if test="remark != null">
remark = #{remark},
</if>
<if test="attr1 != null">
attr1 = #{attr1},
</if>
<if test="attr2 != null">
attr2 = #{attr2},
</if>
<if test="attr3 != null">
attr3 = #{attr3},
</if>
<if test="attr4 != null">
attr4 = #{attr4},
</if>
<if test="createBy != null">
create_by = #{createBy},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateBy != null">
update_by = #{updateBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
</trim>
where area_id = #{areaId}
</update>
<update id="deleteWmStorageAreaByAreaId" parameterType="Long">
update wm_storage_area set IS_DELETE =1
update wm_storage_area
set IS_DELETE =1
where area_id = #{areaId}
</update>
<update id="deleteWmStorageAreaByAreaIds" parameterType="String">
update wm_storage_area set IS_DELETE = 1
update wm_storage_area
set IS_DELETE = 1
where area_id in
<foreach item="areaId" collection="array" open="(" separator="," close=")">
#{areaId}
@ -191,13 +375,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<update id="deleteByWarehouseId" parameterType="Long">
update wm_storage_area set IS_DELETE =1
where location_id in ( select location_id from wm_storage_location where warehouse_id = #{warehouseId})
update wm_storage_area
set IS_DELETE =1
where location_id in (select location_id from wm_storage_location where warehouse_id = #{warehouseId})
</update>
<update id="deleteByLocationId" parameterType="Long">
update wm_storage_area set IS_DELETE = 1
update wm_storage_area
set IS_DELETE = 1
where location_id = #{locationId}
</update>
</mapper>

View File

@ -1,60 +1,85 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ktg.mes.wm.mapper.WmStorageLocationMapper">
<resultMap type="WmStorageLocation" id="WmStorageLocationResult">
<result property="locationId" column="location_id" />
<result property="locationCode" column="location_code" />
<result property="locationName" column="location_name" />
<result property="warehouseId" column="warehouse_id" />
<result property="area" column="area" />
<result property="areaFlag" column="area_flag" />
<result property="frozenFlag" column="frozen_flag" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="locationId" column="location_id"/>
<result property="locationCode" column="location_code"/>
<result property="locationName" column="location_name"/>
<result property="warehouseId" column="warehouse_id"/>
<result property="area" column="area"/>
<result property="areaFlag" column="area_flag"/>
<result property="frozenFlag" column="frozen_flag"/>
<result property="remark" column="remark"/>
<result property="attr1" column="attr1"/>
<result property="attr2" column="attr2"/>
<result property="attr3" column="attr3"/>
<result property="attr4" column="attr4"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<resultMap type="WmStorageLocationVo" id="WmStorageLocationVoResult">
<result property="locationId" column="location_id" />
<result property="locationCode" column="location_code" />
<result property="locationName" column="location_name" />
<result property="warehouseId" column="warehouse_id" />
<result property="area" column="area" />
<result property="areaFlag" column="area_flag" />
<result property="frozenFlag" column="frozen_flag" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="warehouseName" column="warehouse_name" />
<result property="locationId" column="location_id"/>
<result property="locationCode" column="location_code"/>
<result property="locationName" column="location_name"/>
<result property="warehouseId" column="warehouse_id"/>
<result property="area" column="area"/>
<result property="areaFlag" column="area_flag"/>
<result property="frozenFlag" column="frozen_flag"/>
<result property="remark" column="remark"/>
<result property="attr1" column="attr1"/>
<result property="attr2" column="attr2"/>
<result property="attr3" column="attr3"/>
<result property="attr4" column="attr4"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="warehouseName" column="warehouse_name"/>
</resultMap>
<sql id="selectWmStorageLocationVo">
select location_id, location_code, location_name, warehouse_id, area, area_flag, frozen_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_storage_location
select location_id,
location_code,
location_name,
warehouse_id,
area,
area_flag,
frozen_flag,
remark,
attr1,
attr2,
attr3,
attr4,
create_by,
create_time,
update_by,
update_time
from wm_storage_location
</sql>
<select id="selectWmStorageLocationList" parameterType="WmStorageLocation" resultMap="WmStorageLocationResult">
<include refid="selectWmStorageLocationVo"/>
<where>
<if test="locationCode != null and locationCode != ''"> and location_code like concat('%',#{locationCode}, '%') </if>
<if test="locationName != null and locationName != ''"> and location_name like concat('%', #{locationName}, '%')</if>
<if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if>
<if test="area != null "> and area = #{area}</if>
<if test="areaFlag != null and areaFlag != ''"> and area_flag = #{areaFlag}</if>
<where>
<if test="locationCode != null and locationCode != ''">
and location_code like concat('%', #{locationCode}, '%')
</if>
<if test="locationName != null and locationName != ''">
and location_name like concat('%', #{locationName}, '%')
</if>
<if test="warehouseId != null">
and warehouse_id = #{warehouseId}
</if>
<if test="area != null">
and area = #{area}
</if>
<if test="areaFlag != null and areaFlag != ''">
and area_flag = #{areaFlag}
</if>
and IS_DELETE = 0
</where>
</select>
@ -62,114 +87,228 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWmStorageLocationListVo" parameterType="WmStorageLocation" resultMap="WmStorageLocationVoResult">
SELECT l.*, w.warehouse_name
FROM wm_storage_location l
JOIN wm_warehouse w ON w.warehouse_id = l.warehouse_id
JOIN wm_warehouse w ON w.warehouse_id = l.warehouse_id
<where>
<if test="locationCode != null and locationCode != ''"> and l.location_code like concat('%',#{locationCode}, '%') </if>
<if test="locationName != null and locationName != ''"> and l.location_name like concat('%', #{locationName}, '%')</if>
<if test="warehouseId != null "> and w.warehouse_id = #{warehouseId}</if>
<if test="area != null "> and l.area = #{area}</if>
<if test="areaFlag != null and areaFlag != ''"> and l.area_flag = #{areaFlag}</if>
<if test="locationCode != null and locationCode != ''">
and l.location_code like concat('%', #{locationCode}, '%')
</if>
<if test="locationName != null and locationName != ''">
and l.location_name like concat('%', #{locationName}, '%')
</if>
<if test="warehouseId != null">
and w.warehouse_id = #{warehouseId}
</if>
<if test="area != null">
and l.area = #{area}
</if>
<if test="areaFlag != null and areaFlag != ''">
and l.area_flag = #{areaFlag}
</if>
and l.IS_DELETE = 0
</where>
</select>
<select id="selectWmStorageLocationByLocationId" parameterType="Long" resultMap="WmStorageLocationResult">
<include refid="selectWmStorageLocationVo"/>
where location_id = #{locationId} and IS_DELETE = 0
where location_id = #{locationId}
and IS_DELETE = 0
</select>
<select id="selectWmStorageLocationByVoLocationId" parameterType="Long" resultMap="WmStorageLocationVoResult">
select l.* ,w.warehouse_name from wm_storage_location l
join wm_warehouse w on w.warehouse_id = l.warehouse_id
where location_id = #{locationId} and l.IS_DELETE = 0
select l.*, w.warehouse_name
from wm_storage_location l
join wm_warehouse w on w.warehouse_id = l.warehouse_id
where location_id = #{locationId}
and l.IS_DELETE = 0
</select>
<select id="selectWmStorageLocationByLocationCode" parameterType="String" resultMap="WmStorageLocationResult">
<include refid="selectWmStorageLocationVo"/>
where location_code = #{locationCode} limit 1 and IS_DELETE = 0
where location_code = #{locationCode}
and IS_DELETE = 0 limit 1
</select>
<select id="checkLocationCodeUnique" parameterType="WmStorageLocation" resultMap="WmStorageLocationResult">
<include refid="selectWmStorageLocationVo"/>
where location_code = #{locationCode} and IS_DELETE = 0 and warehouse_id = #{warehouseId} limit 1
where location_code = #{locationCode}
and IS_DELETE = 0
and warehouse_id = #{warehouseId} limit 1
</select>
<select id="checkLocationNameUnique" parameterType="WmStorageLocation" resultMap="WmStorageLocationResult">
<include refid="selectWmStorageLocationVo"/>
where location_name = #{locationName} and IS_DELETE = 0 and warehouse_id = #{warehouseId} limit 1
where location_name = #{locationName}
and IS_DELETE = 0
and warehouse_id = #{warehouseId} limit 1
</select>
<insert id="insertWmStorageLocation" parameterType="WmStorageLocation" useGeneratedKeys="true" keyProperty="locationId">
<insert id="insertWmStorageLocation" parameterType="WmStorageLocation" useGeneratedKeys="true"
keyProperty="locationId">
insert into wm_storage_location
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="locationCode != null and locationCode != ''">location_code,</if>
<if test="locationName != null and locationName != ''">location_name,</if>
<if test="warehouseId != null">warehouse_id,</if>
<if test="area != null">area,</if>
<if test="areaFlag != null">area_flag,</if>
<if test="frozenFlag != null">frozen_flag,</if>
<if test="remark != null">remark,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="attr4 != null">attr4,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<if test="locationCode != null and locationCode != ''">
location_code,
</if>
<if test="locationName != null and locationName != ''">
location_name,
</if>
<if test="warehouseId != null">
warehouse_id,
</if>
<if test="area != null">
area,
</if>
<if test="areaFlag != null">
area_flag,
</if>
<if test="frozenFlag != null">
frozen_flag,
</if>
<if test="remark != null">
remark,
</if>
<if test="attr1 != null">
attr1,
</if>
<if test="attr2 != null">
attr2,
</if>
<if test="attr3 != null">
attr3,
</if>
<if test="attr4 != null">
attr4,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateBy != null">
update_by,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="locationCode != null and locationCode != ''">#{locationCode},</if>
<if test="locationName != null and locationName != ''">#{locationName},</if>
<if test="warehouseId != null">#{warehouseId},</if>
<if test="area != null">#{area},</if>
<if test="areaFlag != null">#{areaFlag},</if>
<if test="frozenFlag != null">#{frozenFlag},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
<if test="locationCode != null and locationCode != ''">
#{locationCode},
</if>
<if test="locationName != null and locationName != ''">
#{locationName},
</if>
<if test="warehouseId != null">
#{warehouseId},
</if>
<if test="area != null">
#{area},
</if>
<if test="areaFlag != null">
#{areaFlag},
</if>
<if test="frozenFlag != null">
#{frozenFlag},
</if>
<if test="remark != null">
#{remark},
</if>
<if test="attr1 != null">
#{attr1},
</if>
<if test="attr2 != null">
#{attr2},
</if>
<if test="attr3 != null">
#{attr3},
</if>
<if test="attr4 != null">
#{attr4},
</if>
<if test="createBy != null">
#{createBy},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateBy != null">
#{updateBy},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
</trim>
</insert>
<update id="updateWmStorageLocation" parameterType="WmStorageLocation">
update wm_storage_location
<trim prefix="SET" suffixOverrides=",">
<if test="locationCode != null and locationCode != ''">location_code = #{locationCode},</if>
<if test="locationName != null and locationName != ''">location_name = #{locationName},</if>
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
<if test="area != null">area = #{area},</if>
<if test="areaFlag != null">area_flag = #{areaFlag},</if>
<if test="frozenFlag != null">frozen_flag = #{frozenFlag},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="attr4 != null">attr4 = #{attr4},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="locationCode != null and locationCode != ''">
location_code = #{locationCode},
</if>
<if test="locationName != null and locationName != ''">
location_name = #{locationName},
</if>
<if test="warehouseId != null">
warehouse_id = #{warehouseId},
</if>
<if test="area != null">
area = #{area},
</if>
<if test="areaFlag != null">
area_flag = #{areaFlag},
</if>
<if test="frozenFlag != null">
frozen_flag = #{frozenFlag},
</if>
<if test="remark != null">
remark = #{remark},
</if>
<if test="attr1 != null">
attr1 = #{attr1},
</if>
<if test="attr2 != null">
attr2 = #{attr2},
</if>
<if test="attr3 != null">
attr3 = #{attr3},
</if>
<if test="attr4 != null">
attr4 = #{attr4},
</if>
<if test="createBy != null">
create_by = #{createBy},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateBy != null">
update_by = #{updateBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
</trim>
where location_id = #{locationId}
</update>
<update id="deleteWmStorageLocationByLocationId" parameterType="Long">
update wm_storage_location set IS_DELETE = 1 where location_id = #{locationId}
update wm_storage_location
set IS_DELETE = 1
where location_id = #{locationId}
</update>
<update id="deleteWmStorageLocationByLocationIds" parameterType="String">
update wm_storage_location set IS_DELETE = 1 where location_id in
update wm_storage_location
set IS_DELETE = 1 where location_id in
<foreach item="locationId" collection="array" open="(" separator="," close=")">
#{locationId}
</foreach>
</update>
<update id="deleteByWarehouseId" parameterType="Long">
update wm_storage_location set IS_DELETE = 1 where warehouse_id = #{warehouseId}
update wm_storage_location
set IS_DELETE = 1
where warehouse_id = #{warehouseId}
</update>
</mapper>

View File

@ -31,6 +31,7 @@
<result property="materialUnit" column="MATERIAL_UNIT"/>
<result property="materialName" column="MATERIAL_NAME"/>
<result property="detailInId" column="DETAIL_IN_ID"/>
<result property="boxRfid" column="BOX_RFID"/>
</resultMap>
<sql id="selectWmsInTaskVo">
@ -56,6 +57,7 @@
a.PLAN_IN_CODE,
a.MATERIAL_CODE,
a.DETAIL_IN_ID,
a.BOX_RFID,
b.AREA_CODE as CELL_CODE,
b.AREA_NAME as CELL_NAME,
c.UNIT_NAME AS MATERIAL_UNIT,
@ -89,8 +91,11 @@
<if test="planTypeCode != null and planTypeCode != ''">and PLAN_TYPE_CODE = #{planTypeCode}</if>
<if test="planInStatus != null and planInStatus != ''">and PLAN_IN_STATUS = #{planInStatus}</if>
<if test="planInCode != null and planInCode != ''">and PLAN_IN_CODE = #{planInCode}</if>
<if test="materialCode != null and materialCode != ''">and MATERIAL_CODE like concat('%', #{materialCode}, '%')</if>
<if test="materialCode != null and materialCode != ''">and MATERIAL_CODE like concat('%', #{materialCode},
'%')
</if>
<if test="detailInId != null and detailInId != ''">and DETAIL_IN_ID = #{detailInId}</if>
<if test="boxRfid != null and boxRfid != ''">and BOX_RFID = #{boxRfid}</if>
</where>
order by a.CREATE_TIME desc
</select>
@ -124,6 +129,7 @@
<if test="planInCode != null">PLAN_IN_CODE,</if>
<if test="materialCode != null">MATERIAL_CODE,</if>
<if test="detailInId != null">DETAIL_IN_ID,</if>
<if test="boxRfid != null">BOX_RFID,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskInCode != null">#{taskInCode},</if>
@ -147,6 +153,7 @@
<if test="planInCode != null">#{planInCode},</if>
<if test="materialCode != null">#{materialCode},</if>
<if test="detailInId != null">#{detailInId},</if>
<if test="boxRfid != null">#{boxRfid},</if>
</trim>
</insert>
@ -174,6 +181,7 @@
<if test="planInCode != null">PLAN_IN_CODE = #{planInCode},</if>
<if test="materialCode != null">MATERIAL_CODE = #{materialCode},</if>
<if test="detailInId != null">DETAIL_IN_ID = #{detailInId},</if>
<if test="boxRfid != null">BOX_RFID = #{boxRfid},</if>
</trim>
where ID = #{id}
</update>

View File

@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWmsZdTaskList" parameterType="WmsZdTask" resultMap="WmsZdTaskResult">
<include refid="selectWmsZdTaskVo"/>
<where>
<where>
<if test="code != null and code != ''"> and CODE like concat('%', #{code}, '%')</if>
<if test="name != null and name != ''"> and "name" like concat('%', #{name}, '%')</if>
<if test="mProductId != null and mProductId != ''"> and M_PRODUCT_ID = #{mProductId}</if>
@ -54,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="planOutId != null and planOutId != ''"> and PLAN_OUT_ID = #{planOutId}</if>
<if test="planOutType != null and planOutType != ''"> and PLAN_OUT_TYPE = #{planOutType}</if>
<if test="technologyBomId != null and technologyBomId != ''"> and technology_bom_id = #{technologyBomId}</if>
<if test="planSheet != null and planSheet != ''"> and plan_sheet = #{planSheet}</if>
<if test="qtyOk != null and qtyOk != ''"> and QTY_OK = #{qtyOk}</if>
<if test="remark != null and remark != ''"> and REMARK = #{remark}</if>
<if test="attr1 != null and attr1 != ''"> and ATTR1 = #{attr1}</if>