Compare commits

...

34 Commits

Author SHA1 Message Date
fbe60c4e25 refactor: 出入库类型,设置lombok;增加根据编码查询类型service;typeID类型修改 2025-01-03 16:03:54 +08:00
89eeea78a5 refactor: lombok 2025-01-03 14:56:22 +08:00
eaf2b3ee82 台账出入库明细解开注释 2024-12-20 15:13:10 +08:00
d5904db69a 组装任务生成出库任务绑定明细ID 2024-12-20 10:54:51 +08:00
7c3a232e11 预订表查询物料为空返回空集合 2024-12-20 10:30:57 +08:00
3d9d42019f 生产准备优化 2024-12-19 16:57:23 +08:00
d2ec3f0d79 入库执行解绑订单 2024-12-19 10:27:47 +08:00
8423154873 refactor: 入库计划注释 2024-12-19 10:10:24 +08:00
55ecf2a407 refactor: 入库任务lombok 2024-12-19 10:08:50 +08:00
1ab8185446 refactor: 入库任务查询增加实体 2024-12-19 10:04:54 +08:00
2b39cf8531 Merge remote-tracking branch 'origin/master' 2024-12-19 10:00:04 +08:00
3e1d3f95d1 入库任务执行触发给产线控制系统发生产准备完成请求 2024-12-19 09:58:21 +08:00
c75117d693 fix: 出库任务修复 2024-12-18 17:38:03 +08:00
6622be6dc6 Merge remote-tracking branch 'origin/master' 2024-12-18 11:24:46 +08:00
a17bd18444 修正算法BUG 2024-12-18 11:24:38 +08:00
7a7a809d4d Merge remote-tracking branch 'origin/master' 2024-12-18 10:09:32 +08:00
a6ef663686 refactor: 完善webservice服务 2024-12-18 10:09:16 +08:00
b8a861c5c1 完成入库计划显示库位物料信息,完成整刀rfid根据物料编码加序号自动生成,完成开放更新整刀寿命接口 2024-12-17 17:47:46 +08:00
43bb62dbdc Merge remote-tracking branch 'origin/master' 2024-12-17 11:47:54 +08:00
c6d436526d 初步完成整刀入库机制 2024-12-17 11:47:36 +08:00
ef88d6829e feat: 新增webservice库,同步主数据平台数据 2024-12-17 10:30:28 +08:00
5358dcca31 重命名函数 2024-12-17 10:16:27 +08:00
2e2ff79029 增加限制 2024-12-17 10:15:19 +08:00
2e81d77dee 编写获取一个库位接口 2024-12-17 09:39:31 +08:00
2b8219d01e 修正错误 2024-12-16 17:17:06 +08:00
2ea01a7fff 完善大号物料字段 2024-12-16 16:15:53 +08:00
38bf3825c7 完善注释 2024-12-16 16:03:28 +08:00
29d94ed120 完善注释 2024-12-16 15:36:41 +08:00
f778310a0d 格式化代码 2024-12-16 15:19:29 +08:00
2ccb15dd98 增加注释 2024-12-16 14:41:30 +08:00
c35381b6f6 完成出库任务公开列表增加台账实体数据 2024-12-16 10:44:37 +08:00
655f0ab225 完成出库计划新增接口,并自动执行出库计划,在数量等条件满足的情况下生成相应的出库任务 2024-12-16 10:04:30 +08:00
8fad8ba16c refactor: 完善小型刀具库同步 2024-12-16 08:48:06 +08:00
19ffe615e5 refactor: 系统说明文档补充项目启动问题 2024-12-15 22:19:23 +08:00
41 changed files with 1746 additions and 2241 deletions

View File

@ -1,2 +1,10 @@
<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

@ -47,7 +47,7 @@ spring:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: online
active: dev
# 文件上传
servlet:
multipart:

View File

@ -66,6 +66,12 @@
<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

@ -45,6 +45,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));
}
/**
* 查询出库计划管理列表
*/

View File

@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
import java.util.HashMap;
@ -15,6 +17,8 @@ import java.util.List;
* @author yinjinlu
* @date 2024-10-31
*/
@Setter
@Getter
public class BaseKnife extends BaseEntity {
private static final long serialVersionUID = 1L;
@ -177,254 +181,6 @@ public class BaseKnife extends BaseEntity {
*/
private List<BaseKnife> baseKnifeList;
public Long getBaseKnifeId() {
return baseKnifeId;
}
public void setBaseKnifeId(Long baseKnifeId) {
this.baseKnifeId = baseKnifeId;
}
public Long getMbbBdMrlId() {
return mbbBdMrlId;
}
public void setMbbBdMrlId(Long mbbBdMrlId) {
this.mbbBdMrlId = mbbBdMrlId;
}
public String getRfid() {
return rfid;
}
public void setRfid(String rfid) {
this.rfid = rfid;
}
public String getKnifeCode() {
return knifeCode;
}
public List<BaseKnife> getBaseKnifeList() {
return baseKnifeList;
}
public void setBaseKnifeList(List<BaseKnife> baseKnifeList) {
this.baseKnifeList = baseKnifeList;
}
public Integer getIsLocked() {
return isLocked;
}
public void setIsLocked(Integer isLocked) {
this.isLocked = isLocked;
}
public Date getLockedStartTime() {
return lockedStartTime;
}
public void setLockedStartTime(Date lockedStartTime) {
this.lockedStartTime = lockedStartTime;
}
public Date getLockedEndTime() {
return lockedEndTime;
}
public void setLockedEndTime(Date lockedEndTime) {
this.lockedEndTime = lockedEndTime;
}
public String getPlanSheet() {
return planSheet;
}
public void setPlanSheet(String planSheet) {
this.planSheet = planSheet;
}
public Integer getResetCount() {
return resetCount;
}
public void setResetCount(Integer resetCount) {
this.resetCount = resetCount;
}
public void setKnifeCode(String knifeCode) {
this.knifeCode = knifeCode;
}
public String getKnifeName() {
return knifeName;
}
public void setKnifeName(String knifeName) {
this.knifeName = knifeName;
}
public String getKnifeUnit() {
return knifeUnit;
}
public void setKnifeUnit(String knifeUnit) {
this.knifeUnit = knifeUnit;
}
public String getKnifeType() {
return knifeType;
}
public void setKnifeType(String knifeType) {
this.knifeType = knifeType;
}
public Integer getSafeStock() {
return safeStock;
}
public String getItemOrProduct() {
return itemOrProduct;
}
public void setItemOrProduct(String itemOrProduct) {
this.itemOrProduct = itemOrProduct;
}
public void setSafeStock(Integer safeStock) {
this.safeStock = safeStock;
}
public String getStandardQuantity() {
return standardQuantity;
}
public void setStandardQuantity(String standardQuantity) {
this.standardQuantity = standardQuantity;
}
public String getAreaCode() {
return areaCode;
}
public void setAreaCode(String areaCode) {
this.areaCode = areaCode;
}
public Integer getKnifeLife() {
return knifeLife;
}
public void setKnifeLife(Integer knifeLife) {
this.knifeLife = knifeLife;
}
public Integer getKnifeFineState() {
return knifeFineState;
}
public void setKnifeFineState(Integer knifeFineState) {
this.knifeFineState = knifeFineState;
}
public Long getAttr1() {
return attr1;
}
public void setAttr1(Long attr1) {
this.attr1 = attr1;
}
public String getAttr2() {
return attr2;
}
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
public String getAttr3() {
return attr3;
}
public void setAttr3(String attr3) {
this.attr3 = attr3;
}
public String getAttr4() {
return attr4;
}
public void setAttr4(String attr4) {
this.attr4 = attr4;
}
public List<MdItem> getMdItemList() {
return mdItemList;
}
public void setMdItemList(List<MdItem> mdItemList) {
this.mdItemList = mdItemList;
}
public Date getScrapTime() {
return scrapTime;
}
public void setScrapTime(Date scrapTime) {
this.scrapTime = scrapTime;
}
public List<HashMap<String, Object>> getOutInfoList() {
return outInfoList;
}
public void setOutInfoList(List<HashMap<String, Object>> outInfoList) {
this.outInfoList = outInfoList;
}
public List<WmsInPlanDetailEntity> getInInfoList() {
return inInfoList;
}
public void setInInfoList(List<WmsInPlanDetailEntity> inInfoList) {
this.inInfoList = inInfoList;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public Integer getIsValid() {
return isValid;
}
public void setIsValid(Integer isValid) {
this.isValid = isValid;
}
public Long getZdTaskId() {
return zdTaskId;
}
public void setZdTaskId(Long zdTaskId) {
this.zdTaskId = zdTaskId;
}
public String getAreaName() {
return areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
@Override
public String toString() {
return "BaseKnife{" +

View File

@ -36,11 +36,15 @@ public class MdItem extends BaseEntity {
private String safeStockFlag;
private Integer minStock;
private Double maxStock;
private Double length;
private Double width;
private Double height;
private String highValue;
private Integer attr1;
private Integer attr2;
private String attr3;
private String attr4;
/* 预留字段3 - 为空或者0表示普通物料-1表示大物料 */
private Integer attr3;
private Integer attr4;
private Long count;
@ -203,19 +207,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;
}
@ -227,6 +231,30 @@ public class MdItem extends BaseEntity {
this.count = count;
}
public Double getLength() {
return length;
}
public void setLength(Double length) {
this.length = length;
}
public Double getWidth() {
return width;
}
public void setWidth(Double width) {
this.width = width;
}
public Double getHeight() {
return height;
}
public void setHeight(Double height) {
this.height = height;
}
@Override
public String toString() {
return "MdItem{" +
@ -248,9 +276,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

@ -1,5 +1,7 @@
package com.ktg.mes.md.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;
@ -11,13 +13,15 @@ import com.ktg.common.core.domain.BaseEntity;
* @author yinjinlu
* @date 2024-10-31
*/
@Getter
@Setter
public class WmsBusinessType extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String typeId;
private Long typeId;
/**
* 修改日期
@ -120,190 +124,6 @@ public class WmsBusinessType extends BaseEntity {
@Excel(name = "是否记录入库时间:0否1是")
private String isRecordInboundTime;
public void setTypeId(String typeId) {
this.typeId = typeId;
}
public String getTypeId() {
return typeId;
}
public void setModifyDate(String modifyDate) {
this.modifyDate = modifyDate;
}
public String getModifyDate() {
return modifyDate;
}
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 setCode(String code) {
this.code = code;
}
public String getCode() {
return code;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setFlag(String flag) {
this.flag = flag;
}
public String getFlag() {
return flag;
}
public void setType(String type) {
this.type = type;
}
public String getType() {
return type;
}
public void setIsDefault(String isDefault) {
this.isDefault = isDefault;
}
public String getIsDefault() {
return isDefault;
}
public void setIsGlobal(String isGlobal) {
this.isGlobal = isGlobal;
}
public String getIsGlobal() {
return isGlobal;
}
public void setIsNeedUp(String isNeedUp) {
this.isNeedUp = isNeedUp;
}
public String getIsNeedUp() {
return isNeedUp;
}
public void setQualityType(String qualityType) {
this.qualityType = qualityType;
}
public String getQualityType() {
return qualityType;
}
public void setIsOutboundReview(String isOutboundReview) {
this.isOutboundReview = isOutboundReview;
}
public String getIsOutboundReview() {
return isOutboundReview;
}
public void setWaveStrategy(String waveStrategy) {
this.waveStrategy = waveStrategy;
}
public String getWaveStrategy() {
return waveStrategy;
}
public void setIsMultipleAllowed(String isMultipleAllowed) {
this.isMultipleAllowed = isMultipleAllowed;
}
public String getIsMultipleAllowed() {
return isMultipleAllowed;
}
public void setIsShortageAllowed(String isShortageAllowed) {
this.isShortageAllowed = isShortageAllowed;
}
public String getIsShortageAllowed() {
return isShortageAllowed;
}
public void setIsExcessAllowed(String isExcessAllowed) {
this.isExcessAllowed = isExcessAllowed;
}
public String getIsExcessAllowed() {
return isExcessAllowed;
}
public void setIsWholeOrderPost(String isWholeOrderPost) {
this.isWholeOrderPost = isWholeOrderPost;
}
public String getIsWholeOrderPost() {
return isWholeOrderPost;
}
public void setIsManuallyCreate(String isManuallyCreate) {
this.isManuallyCreate = isManuallyCreate;
}
public String getIsManuallyCreate() {
return isManuallyCreate;
}
public void setIsNoTask(String isNoTask) {
this.isNoTask = isNoTask;
}
public String getIsNoTask() {
return isNoTask;
}
public void setIsNegativeInv(String isNegativeInv) {
this.isNegativeInv = isNegativeInv;
}
public String getIsNegativeInv() {
return isNegativeInv;
}
public void setIsCheckSafetyStock(String isCheckSafetyStock) {
this.isCheckSafetyStock = isCheckSafetyStock;
}
public String getIsCheckSafetyStock() {
return isCheckSafetyStock;
}
public void setIsRecordInboundTime(String isRecordInboundTime) {
this.isRecordInboundTime = isRecordInboundTime;
}
public String getIsRecordInboundTime() {
return isRecordInboundTime;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -137,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;
}
@ -177,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;
}
@ -209,14 +249,6 @@ public class WmsOutTask extends BaseEntity {
this.wmStorageAreaId = wmStorageAreaId;
}
public String getWmsBusinessTypeCode() {
return wmsBusinessTypeCode;
}
public void setWmsBusinessTypeCode(String wmsBusinessTypeCode) {
this.wmsBusinessTypeCode = wmsBusinessTypeCode;
}
public String getBatchNum() {
return batchNum;
}
@ -313,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{" +
@ -321,6 +361,7 @@ public class WmsOutTask extends BaseEntity {
", wmsOutPlanCode='" + wmsOutPlanCode + '\'' +
", wmsOutPlanDetailId=" + wmsOutPlanDetailId +
", wmsBusinessTypeId=" + wmsBusinessTypeId +
", wmsBusinessTypeCode='" + wmsBusinessTypeCode + '\'' +
", taskCode='" + taskCode + '\'' +
", taskNumber=" + taskNumber +
", outNumber=" + outNumber +
@ -337,6 +378,7 @@ public class WmsOutTask extends BaseEntity {
", attr3=" + attr3 +
", attr4=" + attr4 +
", outInfoList=" + outInfoList +
", baseKnifes=" + baseKnifes +
'}';
}
}

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

@ -1,6 +1,7 @@
package com.ktg.mes.md.mapper;
import com.ktg.mes.md.domain.WmsBusinessType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -11,8 +12,8 @@ import java.util.List;
* @author yinjinlu
* @date 2024-10-31
*/
public interface WmsBusinessTypeMapper
{
@Mapper
public interface WmsBusinessTypeMapper {
/**
* 查询出入库类型
*

View File

@ -0,0 +1,41 @@
package com.ktg.mes.md.service;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.swing.*;
@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

@ -19,6 +19,14 @@ public interface IWmsBusinessTypeService
*/
public WmsBusinessType selectWmsBusinessTypeByTypeId(String typeId);
/**
* 查询出入库类型
*
* @param code 出入库类型编码
* @return 出入库类型
*/
public WmsBusinessType selectWmsBusinessTypeByCode(String code);
/**
* 查询出入库类型列表
*

View File

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

View File

@ -45,56 +45,6 @@ public class AP0AEServiceImpl implements IAP0AEService {
@Override
public List<AP0AE> selectReturnedNewData() {
List<AP0AE> ap0aeList = aP0AEMapper.selectInNewData();
ap0aeList.stream().filter(ap0ae -> ap0ae.getAE003() != null).forEach(ap0ae -> {
WmsInPlan wmsInPlan = new WmsInPlan();
wmsInPlan.setPlanCode(MultiModuleCodeGenerator.generateTaskCode("RKP"));
// 发布人
wmsInPlan.setPublishName(ap0ae.getAE004());
// 计划日期
wmsInPlan.setExpectDate(ap0ae.getAE003());
// 入库类型编码 刀片入库
wmsInPlan.setPlanTypeCode("DPRK");
// 库位编码
wmsInPlan.setCellCode(ap0ae.getAE020());
// 业务类型 自动生成
wmsInPlan.setSourceType("XTTB");
// 已执行
wmsInPlan.setState("1");
// 查询库位信息
WmStorageArea wmStorageArea = wmStorageAreaService.selectWmStorageAreaByAreaCode(ap0ae.getAE020());
MdItem mdItem = mdItemService.selectMdItemByCode(ap0ae.getAE014());
//-- 入库计划详情
WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails();
// 状态-待执行
wmsInPlanDetails.setPlanInStatus("0");
// 库位ID
wmsInPlanDetails.setCellId(wmStorageArea.getAreaId());
wmsInPlanDetails.setQuantity(ap0ae.getAE022().toString());
wmsInPlanDetails.setQuantityIn(ap0ae.getAE022().toString());
wmsInPlanDetails.setMaterialId(mdItem.getItemId().toString());
wmsInPlan.setWmsInPlanDetailsList(Collections.singletonList(wmsInPlanDetails));
wmsInPlanService.insertWmsInPlan(wmsInPlan);
// 执行入库计划
wmsInPlanService.issueWmsInPlan(wmsInPlan.getPlanId());
WmsInTask wmsInTask = new WmsInTask();
wmsInTask.setPlanInId(wmsInPlan.getPlanId());
wmsInTask.setPlanInStatus("0");
List<WmsInTask> wmsInTaskList = wmsInTaskService.selectWmsInTaskList(wmsInTask);
List<String> taskId = new ArrayList<>();
wmsInTaskList.forEach(wmsInTask1 -> {
taskId.add(wmsInTask1.getId().toString());
});
wmsInTaskService.issueBatch(taskId.toArray(new String[0]));
ap0ae.setUDF06("ED");
int i = aP0AEMapper.updateInDataToOld(ap0ae);
System.out.println("小型刀具库----" + i);
});
return Collections.emptyList();
return this.aP0AEMapper.selectInNewData();
}
}

View File

@ -127,27 +127,6 @@ public class BaseKnifeServiceImpl implements IBaseKnifeService {
hashMap.put("isToolSetting", nowWmsOutPlanDetailEntity.getIsToolSetting()); // 是否对刀
hashMap.put("toolSettingParam", nowWmsOutPlanDetailEntity.getToolSettingParam()); // 对刀参数
// // 读取xml配置文件
// if ("PRODUCT".equals(nowWmsOutPlanDetailEntity.getItemOrProduct())) {
// try {
// // 抓取远程文件
// this.getRemoteFile();
//
// // 读取本地文件
// File xmlFile = new File(myConfig.getToolSettingXmlPath() + CalendarUtil.getDateTimeStrForFile() + "/TSP1203.xml");
// JAXBContext jaxbContext = JAXBContext.newInstance(Tools.class);
// Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
// Tools paramXml = (Tools) unmarshaller.unmarshal(xmlFile);
//
// hashMap.put("isToolSetting", 1); // 是否对刀
// hashMap.put("toolSettingParam", JSON.toJSONString(paramXml)); // 对刀参数
//
// } catch (Exception e) {
// System.out.println("系统找不到指定文件!");
//// throw new RuntimeException(e);
// }
// }
/* 实体 */
String outTime = null;
if (nowWmsOutPlanDetailEntity.getCreateTime() != null)
@ -176,74 +155,6 @@ public class BaseKnifeServiceImpl implements IBaseKnifeService {
return baseKnifeList;
}
/**
* 获取远程文件
*/
public void getRemoteFile() throws IOException {
try {
// 创建认证用户
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("", myConfig.getRemoteUser(), myConfig.getRemotePass());
// 构建远程文件对象
SmbFile remoteFile = new SmbFile(myConfig.getRemoteUrl(), auth);
// 尝试链接
remoteFile.connect();
if(remoteFile.exists()){
// 获取共享文件夹中文件列表
SmbFile[] smbFiles = remoteFile.listFiles();
for (SmbFile smbFile : smbFiles){
createFile(smbFile);
}
} else {
System.out.println("==============START=================");
System.out.println("远程文件不存在");
System.out.println("===============END==================");
}
} catch (Exception e){
throw new RuntimeException(e);
}
}
/**
* 创建本地文件
*/
public void createFile(SmbFile remoteFile) {
InputStream in = null;
OutputStream out = null;
try {
// 创建本地文件
// File localFile = new File("E:/xml_wjj/" + CalendarUtil.getDateTimeStrForFile() + "/" + remoteFile.getName());
File localFile = new File(myConfig.getToolSettingXmlPath() + CalendarUtil.getDateTimeStrForFile() + "/" + remoteFile.getName());
if (!localFile.getParentFile().exists()) localFile.getParentFile().mkdirs();
if (!localFile.exists()) localFile.createNewFile();
else {
localFile.delete();
localFile.createNewFile();
}
in = new BufferedInputStream(new SmbFileInputStream(remoteFile));
// 获取远程输出流
out = new BufferedOutputStream(new FileOutputStream(localFile));
byte[] buffer = new byte[4096];
int len = 0;
// 写入
while ((len = in.read(buffer, 0, buffer.length)) != -1) {
out.write(buffer, 0, len);
}
out.flush(); // 刷新缓冲
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
try {
if (out != null) out.close();
if (in != null) in.close();
} catch (Exception e){
System.out.println("==============START=================");
System.out.println("关闭资源发生错误!");
System.out.println("===============END==================");
}
}
}
/**
* 新增工具台账
*

View File

@ -0,0 +1,190 @@
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 javax.swing.*;
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

@ -1,7 +1,9 @@
package com.ktg.mes.md.service.impl;
import java.util.List;
import com.ktg.common.utils.DateUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktg.mes.md.mapper.WmsBusinessTypeMapper;
@ -15,10 +17,9 @@ import com.ktg.mes.md.service.IWmsBusinessTypeService;
* @date 2024-10-31
*/
@Service
public class WmsBusinessTypeServiceImpl implements IWmsBusinessTypeService
{
@Autowired
private WmsBusinessTypeMapper wmsBusinessTypeMapper;
@RequiredArgsConstructor
public class WmsBusinessTypeServiceImpl implements IWmsBusinessTypeService {
private final WmsBusinessTypeMapper wmsBusinessTypeMapper;
/**
* 查询出入库类型
@ -27,11 +28,21 @@ public class WmsBusinessTypeServiceImpl implements IWmsBusinessTypeService
* @return 出入库类型
*/
@Override
public WmsBusinessType selectWmsBusinessTypeByTypeId(String typeId)
{
public WmsBusinessType selectWmsBusinessTypeByTypeId(String typeId) {
return wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(typeId);
}
/**
* 查询出入库类型
*
* @param code 出入库类型编码
* @return 出入库类型
*/
@Override
public WmsBusinessType selectWmsBusinessTypeByCode(String code) {
return wmsBusinessTypeMapper.selectWmsBusinessTypeByCode(code);
}
/**
* 查询出入库类型列表
*
@ -39,8 +50,7 @@ public class WmsBusinessTypeServiceImpl implements IWmsBusinessTypeService
* @return 出入库类型
*/
@Override
public List<WmsBusinessType> selectWmsBusinessTypeList(WmsBusinessType wmsBusinessType)
{
public List<WmsBusinessType> selectWmsBusinessTypeList(WmsBusinessType wmsBusinessType) {
return wmsBusinessTypeMapper.selectWmsBusinessTypeList(wmsBusinessType);
}
@ -51,8 +61,7 @@ public class WmsBusinessTypeServiceImpl implements IWmsBusinessTypeService
* @return 结果
*/
@Override
public int insertWmsBusinessType(WmsBusinessType wmsBusinessType)
{
public int insertWmsBusinessType(WmsBusinessType wmsBusinessType) {
wmsBusinessType.setCreateTime(DateUtils.getNowDate());
return wmsBusinessTypeMapper.insertWmsBusinessType(wmsBusinessType);
}
@ -64,8 +73,7 @@ public class WmsBusinessTypeServiceImpl implements IWmsBusinessTypeService
* @return 结果
*/
@Override
public int updateWmsBusinessType(WmsBusinessType wmsBusinessType)
{
public int updateWmsBusinessType(WmsBusinessType wmsBusinessType) {
return wmsBusinessTypeMapper.updateWmsBusinessType(wmsBusinessType);
}
@ -76,8 +84,7 @@ public class WmsBusinessTypeServiceImpl implements IWmsBusinessTypeService
* @return 结果
*/
@Override
public int deleteWmsBusinessTypeByTypeIds(String[] typeIds)
{
public int deleteWmsBusinessTypeByTypeIds(String[] typeIds) {
return wmsBusinessTypeMapper.deleteWmsBusinessTypeByTypeIds(typeIds);
}
@ -88,8 +95,7 @@ public class WmsBusinessTypeServiceImpl implements IWmsBusinessTypeService
* @return 结果
*/
@Override
public int deleteWmsBusinessTypeByTypeId(String typeId)
{
public int deleteWmsBusinessTypeByTypeId(String typeId) {
return wmsBusinessTypeMapper.deleteWmsBusinessTypeByTypeId(typeId);
}
}

View File

@ -90,6 +90,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;
}
/**
* 新增出库计划管理
*
@ -321,7 +331,7 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
// 构建出库计划
WmsOutPlan wmsOutPlan = new WmsOutPlan();
wmsOutPlan.setPlanCode(Long.toString(System.currentTimeMillis(), 32).toUpperCase(Locale.ROOT));
wmsOutPlan.setWmsBusinessTypeId(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("DPCK").getTypeId() != null ? Long.parseLong(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("DPCK").getTypeId()) : 11L);
wmsOutPlan.setWmsBusinessTypeId(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("DPCK").getTypeId() != null ? this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("DPCK").getTypeId() : 11L);
wmsOutPlan.setPlanState("1");
wmsOutPlan.setPlanType("XTTB");
wmsOutPlan.setRemark("同步小型刀具库数据");
@ -437,7 +447,7 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
// 构建出库计划
WmsOutPlan wmsOutPlan = new WmsOutPlan();
wmsOutPlan.setPlanCode(Long.toString(System.currentTimeMillis(), 32).toUpperCase(Locale.ROOT));
wmsOutPlan.setWmsBusinessTypeId(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("DPCK").getTypeId() != null ? Long.parseLong(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("DPCK").getTypeId()) : 11L);
wmsOutPlan.setWmsBusinessTypeId(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("DPCK").getTypeId() != null ? this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("DPCK").getTypeId() : 11L);
wmsOutPlan.setPlanState("1");
wmsOutPlan.setPlanType("XTTB");
wmsOutPlan.setRemark("同步小型刀具库数据");
@ -576,7 +586,7 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
// 构建出库计划
WmsOutPlan wmsOutPlan = new WmsOutPlan();
wmsOutPlan.setPlanCode(Long.toString(System.currentTimeMillis(), 32).toUpperCase(Locale.ROOT));
wmsOutPlan.setWmsBusinessTypeId(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId() != null ? Long.parseLong(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId()) : 14L);
wmsOutPlan.setWmsBusinessTypeId(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId() != null ? this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId() : 14L);
wmsOutPlan.setPlanState("1");
wmsOutPlan.setPlanType("SCZB");
wmsOutPlan.setRemark("一键清退无寿命物品");

View File

@ -10,7 +10,6 @@ import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.WmsZdTask;
import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
import com.ktg.mes.wm.mapper.WmsZdTaskMapper;
import com.ktg.mes.wm.service.IWmStorageAreaService;
import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbFile;
import jcifs.smb.SmbFileInputStream;
@ -27,9 +26,9 @@ 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.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* 出库任务Service业务层处理
@ -98,7 +97,7 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
WmsBusinessType wmsBusinessType = this.wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(wmsOutPlan.getWmsBusinessTypeId().toString());
// 获取库位信息
WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(wmsOutTask.getWmStorageAreaId());
WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaCode(nowWmsOutPlanDetailEntity.getAreaCode());
// 设定出库信息数据
HashMap<String, Object> hashMap = new HashMap<>();
@ -118,7 +117,7 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
hashMap.put("planTypeName", wmsBusinessType.getName()); // 出库类型名称
/* 来自计划明细 */
hashMap.put("detailBatchNum", wmsOutPlanDetail.getDetailBatchNum()); // 明细批次
hashMap.put("wmStorageAreaId", wmsOutPlanDetail.getWmStorageAreaId()); // 库位ID
hashMap.put("wmStorageAreaId", wmStorageArea.getAreaId()); // 库位ID
hashMap.put("wmStorageAreaCode", wmStorageArea.getAreaCode()); // 库位编码
hashMap.put("wmStorageAreaName", wmStorageArea.getAreaName()); // 库位名称
hashMap.put("cellX", wmStorageArea.getPositionX().toString());
@ -161,6 +160,13 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
WmsBusinessType wmsBusinessType = wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(nowWmsOutTask.getWmsBusinessTypeId().toString());
nowWmsOutTask.setWmsBusinessTypeCode(wmsBusinessType.getCode());
wmsOutTasks.add(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 wmsOutTasks;
@ -235,7 +241,8 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
// 获取台账实体如果为整刀则开始读取对刀仪数据
BaseKnife baseKnife = baseKnifeMapper.selectBaseKnifeByBaseKnifeId(wmsOutPlanDetailEntity.getBaseKnifeId());
if (Objects.equals("PRODUCT", baseKnife.getItemOrProduct())) this.readToolSettingRemoteFile(wmsOutPlanDetailEntity);
if (Objects.equals("PRODUCT", baseKnife.getItemOrProduct()))
this.readToolSettingRemoteFile(wmsOutPlanDetailEntity);
}
// 更新出库任务状态
@ -249,7 +256,7 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
WmsZdTask wmsZdTaskWrapper = new WmsZdTask();
wmsZdTaskWrapper.setCode(wmsOutTask.getWmsOutPlanCode());
List<WmsZdTask> wmsZdTaskList = wmsZdTaskMapper.selectWmsZdTaskList(wmsZdTaskWrapper);
if (!wmsZdTaskList.isEmpty()){
if (!wmsZdTaskList.isEmpty()) {
// 获取组装任务
WmsZdTask wmsZdTask = wmsZdTaskList.get(0);
@ -259,15 +266,17 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
List<WmsOutTask> wmsOutTaskList = wmsOutTaskMapper.selectWmsOutTaskList(wmsOutTaskWrapper);
// 遍历状态
for (WmsOutTask item: wmsOutTaskList){
if (Objects.equals("0", item.getTaskState())) {
flag = false;
break;
}
for (WmsOutTask item : wmsOutTaskList) {
if (Objects.equals("0", item.getTaskState())) {
flag = false;
break;
}
}
}
if (flag) { this.wmsZdTaskFinish(wmsOutTask.getWmsOutPlanCode()); }
if (flag) {
this.wmsZdTaskFinish(wmsOutTask.getWmsOutPlanCode());
}
}
return true;
@ -290,11 +299,11 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
SmbFile remoteFile = new SmbFile(myConfig.getRemoteUrl(), auth);
// 尝试链接
remoteFile.connect();
if(remoteFile.exists()){
if (remoteFile.exists()) {
// 获取共享文件夹中文件列表
SmbFile[] smbFiles = remoteFile.listFiles();
for (SmbFile smbFile : smbFiles){
if (smbFile.isFile()){
for (SmbFile smbFile : smbFiles) {
if (smbFile.isFile()) {
// Path path = Paths.get(smbFile.getPath()); // 根据文件的绝对路径获取文件
// BasicFileAttributes attributes = Files.readAttributes(path, BasicFileAttributes.class); // 根据path获取文件的基本属性
// FileTime fileTime = attributes.creationTime(); // 从基本属性中获取文件的创建时间
@ -302,7 +311,7 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
// 时间戳比较
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (dateFormat.parse(currentDate).getTime() < smbFile.lastModified()){
if (dateFormat.parse(currentDate).getTime() < smbFile.lastModified()) {
// 停止扫描
this.cancel();
@ -325,7 +334,7 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
} else {
throw new RuntimeException("远程共享文件夹不存在或无法连接!");
}
} catch (Exception e){
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@ -365,7 +374,7 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
try {
if (out != null) out.close();
if (in != null) in.close();
} catch (Exception e){
} catch (Exception e) {
System.out.println("==============START=================");
System.out.println("关闭资源发生错误!");
System.out.println("===============END==================");
@ -384,39 +393,39 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
public void run() {
File folder = new File(myConfig.getRemoteUrl());
File[] files = folder.listFiles();
for (File file : files){
if (file.isFile()) {
try {
// 根据文件的绝对路径获取文件
Path path = Paths.get(file.getAbsolutePath());
for (File file : files) {
if (file.isFile()) {
try {
// 根据文件的绝对路径获取文件
Path path = Paths.get(file.getAbsolutePath());
// 根据path获取文件的基本属性
BasicFileAttributes attributes = Files.readAttributes(path, BasicFileAttributes.class);
// 根据path获取文件的基本属性
BasicFileAttributes attributes = Files.readAttributes(path, BasicFileAttributes.class);
// 从基本属性中获取文件的创建时间
FileTime fileTime = attributes.creationTime();
// 从基本属性中获取文件的创建时间
FileTime fileTime = attributes.creationTime();
// 将创建时间转换成毫秒
long millis = fileTime.toMillis();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date();
date.setTime(millis);
// 将创建时间转换成毫秒
long millis = fileTime.toMillis();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date();
date.setTime(millis);
// 毫秒转换成时间字符串
String fileCreateTime = dateFormat.format(date);
// 毫秒转换成时间字符串
String fileCreateTime = dateFormat.format(date);
// 时间戳比较
if (dateFormat.parse(currentDate).getTime() < dateFormat.parse(fileCreateTime).getTime()){
System.out.println("文件创建时间:" + fileCreateTime);
System.out.println("文件名:" + file.getName());
// 时间戳比较
if (dateFormat.parse(currentDate).getTime() < dateFormat.parse(fileCreateTime).getTime()) {
System.out.println("文件创建时间:" + fileCreateTime);
System.out.println("文件名:" + file.getName());
// 停止扫描
this.cancel();
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
// 停止扫描
this.cancel();
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
}
};
@ -424,16 +433,16 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
}
public void wmsZdTaskFinish(String planCode){
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);
// 获取组装任务 更新状态
WmsZdTask wmsZdTask = wmsZdTaskList.get(0);
wmsZdTask.setStatus("1");
wmsZdTaskMapper.updateWmsZdTask(wmsZdTask);
}
}
@ -446,7 +455,7 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
// 获取当前实体台账
BaseKnife baseKnife = baseKnifeMapper.selectBaseKnifeByBaseKnifeId(wmsOutPlanDetailEntity.getBaseKnifeId());
if (Objects.equals(baseKnife.getRfid(), paramXml.getRfid())){
if (Objects.equals(baseKnife.getRfid(), paramXml.getRfid())) {
wmsOutPlanDetailEntity.setIsToolSetting(1);
wmsOutPlanDetailEntity.setToolSettingParam("rfid: " + paramXml.getRfid() + " name: " + paramXml.getName() + " param: " + paramXml.getParam());
wmsOutPlanDetailEntityMapper.updateWmsOutPlanDetailEntity(wmsOutPlanDetailEntity);

View File

@ -13,6 +13,12 @@ public interface InventoryAdjustmentMapper {
@DataSource(DataSourceType.SQLSERVER)
List<InventoryAdjustment> selectOutNewData();
@DataSource(DataSourceType.SQLSERVER)
List<InventoryAdjustment> selectInNewData();
@DataSource(DataSourceType.SQLSERVER)
int updateOutDataToOld(InventoryAdjustment inventoryAdjustment);
@DataSource(DataSourceType.SQLSERVER)
int updateInDataToOld(InventoryAdjustment inventoryAdjustment);
}

View File

@ -1,31 +1,24 @@
package com.ktg.mes.wm.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ktg.common.constant.UserConstants;
import com.ktg.mes.wm.domain.vo.WmStorageLocationVo;
import com.ktg.mes.wm.service.IWmStorageAreaService;
import com.ktg.mes.wm.utils.WmBarCodeUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ktg.common.annotation.Log;
import com.ktg.common.constant.UserConstants;
import com.ktg.common.core.controller.BaseController;
import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.enums.BusinessType;
import com.ktg.mes.wm.domain.WmStorageLocation;
import com.ktg.mes.wm.service.IWmStorageLocationService;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
import com.ktg.common.enums.BusinessType;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.mes.wm.domain.WmStorageLocation;
import com.ktg.mes.wm.domain.vo.WmStorageLocationVo;
import com.ktg.mes.wm.service.IWmStorageAreaService;
import com.ktg.mes.wm.service.IWmStorageLocationService;
import com.ktg.mes.wm.utils.WmBarCodeUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 库区设置Controller
@ -35,8 +28,7 @@ import com.ktg.common.core.page.TableDataInfo;
*/
@RestController
@RequestMapping("/mes/wm/location")
public class WmStorageLocationController extends BaseController
{
public class WmStorageLocationController extends BaseController {
@Autowired
private IWmStorageLocationService wmStorageLocationService;
@ -50,8 +42,7 @@ public class WmStorageLocationController extends BaseController
* 查询库区设置列表
*/
@GetMapping("/list")
public TableDataInfo list(WmStorageLocation wmStorageLocation)
{
public TableDataInfo list(WmStorageLocation wmStorageLocation) {
startPage();
List<WmStorageLocationVo> list = wmStorageLocationService.selectWmStorageLocationListVo(wmStorageLocation);
return getDataTable(list);
@ -63,8 +54,7 @@ public class WmStorageLocationController extends BaseController
@PreAuthorize("@ss.hasPermi('mes:wm:location:export')")
@Log(title = "库区设置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WmStorageLocation wmStorageLocation)
{
public void export(HttpServletResponse response, WmStorageLocation wmStorageLocation) {
List<WmStorageLocation> list = wmStorageLocationService.selectWmStorageLocationList(wmStorageLocation);
ExcelUtil<WmStorageLocation> util = new ExcelUtil<WmStorageLocation>(WmStorageLocation.class);
util.exportExcel(response, list, "库区设置数据");
@ -75,8 +65,7 @@ public class WmStorageLocationController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('mes:wm:location:query')")
@GetMapping(value = "/{locationId}")
public AjaxResult getInfo(@PathVariable("locationId") Long locationId)
{
public AjaxResult getInfo(@PathVariable("locationId") Long locationId) {
return AjaxResult.success(wmStorageLocationService.selectWmStorageLocationVoByLocationId(locationId));
}
@ -86,16 +75,15 @@ public class WmStorageLocationController extends BaseController
@PreAuthorize("@ss.hasPermi('mes:wm:location:add')")
@Log(title = "库区设置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WmStorageLocation wmStorageLocation)
{
if(UserConstants.NOT_UNIQUE.equals(wmStorageLocationService.checkLocationCodeUnique(wmStorageLocation))){
public AjaxResult add(@RequestBody WmStorageLocation wmStorageLocation) {
if (UserConstants.NOT_UNIQUE.equals(wmStorageLocationService.checkLocationCodeUnique(wmStorageLocation))) {
return AjaxResult.error("库区编码已存在!");
}
if(UserConstants.NOT_UNIQUE.equals(wmStorageLocationService.checkLocationNameUnique(wmStorageLocation))){
if (UserConstants.NOT_UNIQUE.equals(wmStorageLocationService.checkLocationNameUnique(wmStorageLocation))) {
return AjaxResult.error("库区名称已存在!");
}
wmStorageLocationService.insertWmStorageLocation(wmStorageLocation);
wmBarCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_WAREHOUSE,wmStorageLocation.getLocationId(),wmStorageLocation.getLocationCode(),wmStorageLocation.getLocationName());
wmBarCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_WAREHOUSE, wmStorageLocation.getLocationId(), wmStorageLocation.getLocationCode(), wmStorageLocation.getLocationName());
return AjaxResult.success(wmStorageLocation.getLocationId());
}
@ -105,8 +93,7 @@ public class WmStorageLocationController extends BaseController
@PreAuthorize("@ss.hasPermi('mes:wm:location:edit')")
@Log(title = "库区设置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WmStorageLocation wmStorageLocation)
{
public AjaxResult edit(@RequestBody WmStorageLocation wmStorageLocation) {
return toAjax(wmStorageLocationService.updateWmStorageLocation(wmStorageLocation));
}
@ -116,13 +103,12 @@ public class WmStorageLocationController extends BaseController
@PreAuthorize("@ss.hasPermi('mes:wm:location:remove')")
@Log(title = "库区设置", businessType = BusinessType.DELETE)
@Transactional
@DeleteMapping("/{locationIds}")
public AjaxResult remove(@PathVariable Long[] locationIds)
{
@DeleteMapping("/{locationIds}")
public AjaxResult remove(@PathVariable Long[] locationIds) {
//TODO:库区删除之前的逻辑校验
for (Long locationId: locationIds
) {
for (Long locationId : locationIds
) {
wmStorageAreaService.deleteByLocationId(locationId);
}
return toAjax(wmStorageLocationService.deleteWmStorageLocationByLocationIds(locationIds));

View File

@ -1,27 +1,24 @@
package com.ktg.mes.wm.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ktg.mes.md.service.IAP0AEService;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ktg.common.annotation.Log;
import com.ktg.common.core.controller.BaseController;
import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.enums.BusinessType;
import com.ktg.mes.wm.domain.WmsInPlan;
import com.ktg.mes.wm.service.IWmsInPlanService;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
import com.ktg.common.enums.BusinessType;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.mes.md.domain.MdItem;
import com.ktg.mes.md.mapper.MdItemMapper;
import com.ktg.mes.md.service.IAP0AEService;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.WmsInPlan;
import com.ktg.mes.wm.service.IWmStorageLocationService;
import com.ktg.mes.wm.service.IWmsInPlanService;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 入库计划Controller
@ -34,6 +31,8 @@ import com.ktg.common.core.page.TableDataInfo;
@RequiredArgsConstructor
public class WmsInPlanController extends BaseController {
private final IWmsInPlanService wmsInPlanService;
private final IWmStorageLocationService wmStorageLocationService;
private final MdItemMapper mdItemMapper;
private final IAP0AEService iAP0AEService;
/**
@ -52,7 +51,7 @@ public class WmsInPlanController extends BaseController {
*/
@GetMapping(value = "/sync")
public AjaxResult sync() {
return AjaxResult.success(iAP0AEService.selectReturnedNewData());
return AjaxResult.success(wmsInPlanService.asyncSmallKnifeData());
}
/**
@ -89,6 +88,22 @@ public class WmsInPlanController extends BaseController {
@Log(title = "入库计划", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WmsInPlan wmsInPlan) {
// 校验是否指定了库区
if (wmsInPlan.getLocationCode() != null && !wmsInPlan.getLocationCode().isEmpty()) {
wmsInPlan.getWmsInPlanDetailsList().forEach(wmsInPlanDetails -> {
// 获得物料ID
MdItem mdItemById = mdItemMapper.selectMdItemById(Long.parseLong(wmsInPlanDetails.getMaterialId()));
if (mdItemById == null) throw new RuntimeException("操作失败,该物料不存在");
// 根据限定条件自动获取库位
WmStorageArea wmStorageArea = wmStorageLocationService.queryOneAreaByLocationCode(wmsInPlan.getLocationCode(), mdItemById.getAttr3() == 1);
if (wmStorageArea == null) throw new RuntimeException("操作失败,缺少空闲库位");
// 设定库位
wmsInPlanDetails.setCellId(wmStorageArea.getAreaId());
});
}
return toAjax(wmsInPlanService.insertWmsInPlan(wmsInPlan));
}

View File

@ -1,5 +1,6 @@
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;
@ -9,12 +10,17 @@ 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.cal.utils.CalendarUtil;
import com.ktg.mes.md.domain.*;
import com.ktg.mes.md.service.IBaseKnifeService;
import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.wm.domain.*;
import com.ktg.mes.wm.service.*;
import lombok.RequiredArgsConstructor;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
@ -23,6 +29,7 @@ import org.springframework.web.bind.annotation.*;
import static com.ktg.generator.util.MultiModuleCodeGenerator.generateTaskCode;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.stream.Stream;
@ -57,6 +64,7 @@ public class WmsInTaskController extends BaseController {
private final WmsZdTaskMapper wmsZdTaskMapper;
private final WmStorageAreaMapper wmStorageAreaMapper;
private final BaseKnifeLockedMapper baseKnifeLockedMapper;
private final MyConfig myConfig;
/**
* 查询入库任务列表
@ -151,7 +159,7 @@ public class WmsInTaskController extends BaseController {
@PostMapping("/open/issueBatch/{ids}")
@ResponseBody
@Transactional
public AjaxResult issueBatch(@PathVariable String[] ids) {
public AjaxResult issueBatch(@PathVariable String[] ids) throws IOException {
for (String taskId : ids) {
// 获取任务信息
WmsInTask wmsInTask = wmsInTaskService.selectWmsInTaskById(taskId);
@ -242,9 +250,12 @@ public class WmsInTaskController extends BaseController {
List<BaseKnifeLocked> baseKnifeLockedList = baseKnifeLockedMapper.selectBaseKnifeLockedList(baseKnifeLockedWrapper);
// 获取实体并修改状态
BaseKnifeLocked baseKnifeLocked = baseKnifeLockedList.get(0);
baseKnifeLocked.setStatus(1);
baseKnifeLockedMapper.updateBaseKnifeLocked(baseKnifeLocked);
BaseKnifeLocked baseKnifeLocked;
if (!baseKnifeLockedList.isEmpty()){
baseKnifeLocked = baseKnifeLockedList.get(0);
baseKnifeLocked.setStatus(1);
baseKnifeLockedMapper.updateBaseKnifeLocked(baseKnifeLocked);
}
// 再次查询物料是否有预订订单
baseKnifeLockedWrapper.setPlanSheet(null);
@ -258,10 +269,16 @@ public class WmsInTaskController extends BaseController {
baseKnifeService.updateBaseKnife(baseKnife);
// 检测订单是否完成完成则出库整刀
if (this.checkFinal(baseKnifeLocked.getPlanSheet())) this.createOutTask(baseKnifeLocked.getPlanSheet());
if (this.checkFinal(baseKnifeLocked.getPlanSheet())) {
try {
this.createOutTask(baseKnifeLocked.getPlanSheet());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
} else {
// 订单解绑
baseKnife.setPlanSheet(null);
baseKnife.setPlanSheet("");
baseKnifeService.updateBaseKnife(baseKnife);
}
}
@ -360,7 +377,7 @@ public class WmsInTaskController extends BaseController {
// 检查订单完成状态
@Transactional
public void createOutTask(String planSheet) {
public void createOutTask(String planSheet) throws IOException {
// 构建出库计划
WmsOutPlan outPlan = new WmsOutPlan();
outPlan.setPlanCode(planSheet);
@ -476,5 +493,70 @@ public class WmsInTaskController extends BaseController {
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,6 +1,7 @@
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;
@ -12,151 +13,167 @@ import com.ktg.common.core.domain.BaseEntity;
* @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

@ -159,6 +159,11 @@ public class WmsInPlan extends BaseEntity {
*/
private String planTypeCode;
/**
* 库区编码
*/
private String locationCode;
/**
* 入库计划明细信息
*/
@ -364,6 +369,14 @@ public class WmsInPlan extends BaseEntity {
this.wmsInPlanDetailsList = wmsInPlanDetailsList;
}
public String getLocationCode() {
return locationCode;
}
public void setLocationCode(String locationCode) {
this.locationCode = locationCode;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

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;
@ -141,206 +145,6 @@ public class WmsInTask extends BaseEntity {
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.WmsInPlanDetailEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 入库计划明细实体Mapper接口
@ -9,6 +10,7 @@ import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
* @author yinjinlu
* @date 2024-11-05
*/
@Mapper
public interface WmsInPlanDetailEntityMapper
{
/**

View File

@ -3,6 +3,7 @@ package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.WmsInPlan;
import com.ktg.mes.wm.domain.WmsInPlanDetails;
import org.apache.ibatis.annotations.Mapper;
/**
* 入库计划Mapper接口
@ -10,6 +11,7 @@ import com.ktg.mes.wm.domain.WmsInPlanDetails;
* @author yinjinlu
* @date 2024-10-31
*/
@Mapper
public interface WmsInPlanMapper
{
/**

View File

@ -1,17 +1,18 @@
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;
import java.util.List;
/**
* 库区设置Service接口
*
* @author yinjinlu
* @date 2022-05-07
*/
public interface IWmStorageLocationService
{
public interface IWmStorageLocationService {
/**
* 查询库区设置
*
@ -31,6 +32,7 @@ public interface IWmStorageLocationService
/**
* 根据库区编码查询库区
*
* @param locationCode
* @return
*/
@ -55,6 +57,7 @@ public interface IWmStorageLocationService
/**
* 检查库区编码是否唯一
*
* @param wmStorageLocation
* @return
*/
@ -62,6 +65,7 @@ public interface IWmStorageLocationService
/**
* 检查库区名称是否唯一
*
* @param wmStorageLocation
* @return
*/
@ -101,8 +105,18 @@ public interface IWmStorageLocationService
/**
* 根据仓库删除对应的库区
*
* @param warehouseId
* @return
*/
public int deleteByWarehouseId(Long warehouseId);
/**
* 查询一个库位
*
* @param code 库区编码
* @param isBig 是否大件
* @return 库位
*/
WmStorageArea queryOneAreaByLocationCode(String code, Boolean isBig);
}

View File

@ -29,6 +29,8 @@ public interface IWmsInPlanService
*/
public List<WmsInPlan> selectWmsInPlanList(WmsInPlan wmsInPlan);
public int asyncSmallKnifeData();
/**
* 新增入库计划
*

View File

@ -1,17 +1,20 @@
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.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业务层处理
@ -20,11 +23,16 @@ import com.ktg.mes.wm.service.IWmStorageLocationService;
* @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;
/**
* 查询库区设置
*
@ -32,8 +40,7 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
* @return 库区设置
*/
@Override
public WmStorageLocation selectWmStorageLocationByLocationId(Long locationId)
{
public WmStorageLocation selectWmStorageLocationByLocationId(Long locationId) {
return wmStorageLocationMapper.selectWmStorageLocationByLocationId(locationId);
}
@ -44,10 +51,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);
@ -60,8 +67,7 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
* @return 库区设置
*/
@Override
public List<WmStorageLocation> selectWmStorageLocationList(WmStorageLocation wmStorageLocation)
{
public List<WmStorageLocation> selectWmStorageLocationList(WmStorageLocation wmStorageLocation) {
return wmStorageLocationMapper.selectWmStorageLocationList(wmStorageLocation);
}
@ -72,16 +78,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 +95,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;
@ -104,8 +109,7 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
* @return 结果
*/
@Override
public int insertWmStorageLocation(WmStorageLocation wmStorageLocation)
{
public int insertWmStorageLocation(WmStorageLocation wmStorageLocation) {
wmStorageLocation.setCreateTime(DateUtils.getNowDate());
return wmStorageLocationMapper.insertWmStorageLocation(wmStorageLocation);
}
@ -117,8 +121,7 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
* @return 结果
*/
@Override
public int updateWmStorageLocation(WmStorageLocation wmStorageLocation)
{
public int updateWmStorageLocation(WmStorageLocation wmStorageLocation) {
wmStorageLocation.setUpdateTime(DateUtils.getNowDate());
return wmStorageLocationMapper.updateWmStorageLocation(wmStorageLocation);
}
@ -130,8 +133,7 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
* @return 结果
*/
@Override
public int deleteWmStorageLocationByLocationIds(Long[] locationIds)
{
public int deleteWmStorageLocationByLocationIds(Long[] locationIds) {
return wmStorageLocationMapper.deleteWmStorageLocationByLocationIds(locationIds);
}
@ -142,8 +144,7 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
* @return 结果
*/
@Override
public int deleteWmStorageLocationByLocationId(Long locationId)
{
public int deleteWmStorageLocationByLocationId(Long locationId) {
return wmStorageLocationMapper.deleteWmStorageLocationByLocationId(locationId);
}
@ -151,4 +152,27 @@ 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> selectNotEmptyAreaCodeList = this.baseKnifeMapper.selectNotEmptyAreaCodeList();
// 获取库位列表
WmStorageArea wmStorageAreaQuery = new WmStorageArea();
wmStorageAreaQuery.setLocationId(wmStorageLocationByCode.getLocationId());
wmStorageAreaQuery.setAttr3(isBig ? 1L : 0L);
List<WmStorageArea> wmStorageAreaList = this.wmStorageAreaMapper.selectWmStorageAreaList(wmStorageAreaQuery).stream()
// 过滤掉全部存在物品的库位
.filter(it -> !selectNotEmptyAreaCodeList.contains(it.getAreaCode()))
.collect(Collectors.toList());
if (wmStorageAreaList.isEmpty()) throw new RuntimeException("自动获取库位失败,无可用库位");
// 返回第一个可用的库位
return wmStorageAreaList.get(0);
}
}

View File

@ -1,17 +1,21 @@
package com.ktg.mes.wm.service.impl;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import com.ktg.common.utils.DateUtils;
import com.ktg.generator.util.MultiModuleCodeGenerator;
import com.ktg.mes.md.domain.MdItem;
import com.ktg.mes.md.mapper.AP0AEMapper;
import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
import com.ktg.mes.wm.domain.WmsInTask;
import com.ktg.mes.stl.domain.InventoryAdjustment;
import com.ktg.mes.stl.mapper.InventoryAdjustmentMapper;
import com.ktg.mes.wm.domain.*;
import com.ktg.mes.wm.mapper.WmsInPlanDetailEntityMapper;
import com.ktg.mes.wm.service.IWmStorageAreaService;
import com.ktg.mes.wm.service.IWmsInTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@ -19,9 +23,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import com.ktg.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.ktg.mes.wm.domain.WmsInPlanDetails;
import com.ktg.mes.wm.mapper.WmsInPlanMapper;
import com.ktg.mes.wm.domain.WmsInPlan;
import com.ktg.mes.wm.service.IWmsInPlanService;
/**
@ -31,18 +33,15 @@ import com.ktg.mes.wm.service.IWmsInPlanService;
* @date 2024-10-31
*/
@Service
@RequiredArgsConstructor
public class WmsInPlanServiceImpl implements IWmsInPlanService {
@Autowired
private WmsInPlanMapper wmsInPlanMapper;
@Autowired
private WmsInPlanDetailEntityMapper wmsInPlanDetailEntityMapper;
@Autowired
private IWmsInTaskService wmsInTaskService;
@Autowired
private IMdItemService mdItemService;
private final WmsInPlanMapper wmsInPlanMapper;
private final WmsInPlanDetailEntityMapper wmsInPlanDetailEntityMapper;
private final IWmStorageAreaService wmStorageAreaService;
private final IWmsInTaskService wmsInTaskService;
private final IMdItemService mdItemService;
private final AP0AEMapper ap0AEMapper;
private final InventoryAdjustmentMapper inventoryAdjustmentMapper;
/**
* 查询入库计划
@ -81,6 +80,66 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
return wmsInPlanMapper.selectWmsInPlanList(wmsInPlan);
}
/**
* 同步小型刀具库数据
*/
@Override
public int asyncSmallKnifeData() {
// List<AP0AE> ap0aeList = ap0AEMapper.selectInNewData();
List<InventoryAdjustment> inventoryAdjustments = inventoryAdjustmentMapper.selectInNewData();
int count = 0;
inventoryAdjustments.stream().filter(adjustment -> adjustment.getBillDate() != null).forEach(ap0ae -> {
WmsInPlan wmsInPlan = new WmsInPlan();
wmsInPlan.setPlanCode(MultiModuleCodeGenerator.generateTaskCode("RKP"));
// 发布人
wmsInPlan.setPublishName(ap0ae.getDataEntryClerk());
// 计划日期
wmsInPlan.setExpectDate(ap0ae.getInTime());
// 入库类型编码 刀片入库
wmsInPlan.setPlanTypeCode("DPRK");
// 库位编码
wmsInPlan.setCellCode(ap0ae.getInWarehouse());
// 业务类型 自动生成
wmsInPlan.setSourceType("XTTB");
// 已执行
wmsInPlan.setState("1");
// 查询库位信息
WmStorageArea wmStorageArea = wmStorageAreaService.selectWmStorageAreaByAreaCode(ap0ae.getInWarehouse());
MdItem mdItem = mdItemService.selectMdItemByCode(ap0ae.getProductNumber());
//-- 入库计划详情
WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails();
// 状态-待执行
wmsInPlanDetails.setPlanInStatus("0");
// 库位ID
wmsInPlanDetails.setCellId(wmStorageArea.getAreaId());
wmsInPlanDetails.setQuantity(ap0ae.getQuantity().toString());
wmsInPlanDetails.setQuantityIn(ap0ae.getQuantity().toString());
wmsInPlanDetails.setMaterialId(mdItem.getItemId().toString());
wmsInPlan.setWmsInPlanDetailsList(Collections.singletonList(wmsInPlanDetails));
this.insertWmsInPlan(wmsInPlan);
// 执行入库计划
this.issueWmsInPlan(wmsInPlan.getPlanId());
WmsInTask wmsInTask = new WmsInTask();
wmsInTask.setPlanInId(wmsInPlan.getPlanId());
wmsInTask.setPlanInStatus("0");
List<WmsInTask> wmsInTaskList = wmsInTaskService.selectWmsInTaskList(wmsInTask);
List<String> taskId = new ArrayList<>();
wmsInTaskList.forEach(wmsInTask1 -> {
taskId.add(wmsInTask1.getId().toString());
});
wmsInTaskService.issueBatch(taskId.toArray(new String[0]));
ap0ae.setCustomField1("ED");
int i = inventoryAdjustmentMapper.updateInDataToOld(ap0ae);
System.out.println("小型刀具库----" + i);
});
return count;
}
/**
* 新增入库计划
*

View File

@ -32,9 +32,7 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService {
private final IMdItemService mdItemService;
private final IWmsInPlanDetailEntityService wmsInPlanDetailEntityService;
private final WmStorageAreaMapper wmStorageAreaMapper;
private final IWmsInPlanService wmsInPlanService;
private final IWmStorageAreaService wmStorageAreaService;
private final IWmsZdTaskService wmsZdTaskService;
private final IBaseKnifeService baseKnifeService;
/**

View File

@ -204,7 +204,7 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
productionArrangements = productionArrangementsMapper.selectProductionArrangementsList(productionArrangementsWrapper).get(0);
}
// 出库基础物料 根据号查询出库计划如果不存在生成计划存在则往计划中添加任务
// 出库基础物料 根据订单号查询出库计划如果不存在生成计划存在则往计划中添加任务
WmsOutPlan outPlan = wmsOutPlanMapper.selectWmsOutPlanByPlanCode(zdTask.getCode());
if (outPlan == null) {
// 构建新的出库计划
@ -237,7 +237,7 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
baseKnife.setKnifeLife(100);
baseKnife.setKnifeFineState(1);
baseKnife.setIsValid(1);
// 判断是否需要锁定整刀
// 判断是否需要锁定整刀来自订单的组装任务需要锁定
if (lockedFlag) {
baseKnife.setIsLocked(1);
baseKnife.setKnifeFineState(1);
@ -270,7 +270,6 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
// 锁定物料
int resetCount = 0;
String rfid = "";
for (MbbProduBom mbbProduBom : bomRoute.getMbbProduBomList()) {
// 查询未锁定的物料
baseKnifeWrapper.setMbbBdMrlId(mbbProduBom.getMdItemId());
@ -281,12 +280,9 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
int bomCount = mbbProduBom.getStandardDosage();
for (BaseKnife wmsBaseKnife : baseKnifeList) {
if (bomCount > 0) {
if ("ITEM".equals(wmsBaseKnife.getItemOrProduct())) rfid = wmsBaseKnife.getRfid();
// 绑定到组装任务 整刀父id
wmsBaseKnife.setZdTaskId(zdTask.getWmsZdTaskId());
wmsBaseKnife.setIsLocked(1);
wmsBaseKnife.setRfid("");
// wmsBaseKnife.setLockedStartTime(technologyBom.getLockedStartTime());
// wmsBaseKnife.setLockedEndTime(technologyBom.getLockedEndTime());
wmsBaseKnife.setParentId(baseKnife.getBaseKnifeId());
wmsBaseKnife.setPlanSheet(zdTask.getPlanSheet());
baseKnifeListOutPlan.add(wmsBaseKnife);
@ -301,7 +297,9 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
// 更新重置次数
baseKnife.setResetCount(resetCount - 1);
baseKnife.setRfid(rfid);
// 设置rfid, 为整刀编码加序号 例如整刀编码为 aaa 则整刀rfid为 aaa0001 aaa0002, 传个i在当前事务中新增的台账还没提交所以把循环系数加上
baseKnife.setRfid(this.getProductRfid(zdTask.getmProductId(), i));
baseKnifeMapper.updateBaseKnife(baseKnife);
}
@ -397,6 +395,19 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
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
@ -460,6 +471,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();
@ -477,21 +491,11 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
wmsInTask.setPlanTypeId("9");
wmsInTask.setPlanTypeCode("ZDHK");
wmsInTask.setPlanInStatus("0");
wmsInTask.setDetailInId(wmsInPlan.getWmsInPlanDetailsList().get(0).getDetailsId());
wmsInTask.setDetailInId(inPlanTemp.getWmsInPlanDetailsList().get(0).getDetailsId());
wmsInTask.setCreateBy(getUsername());
wmsInTask.setCreateTime(DateUtils.getNowDate());
wmsInTaskMapper.insertWmsInTask(wmsInTask);
// // 刀台账设为有效
// baseKnifeList.forEach(baseKnife -> {
// baseKnife.setIsValid(0);
// baseKnife.setCreateTime(DateUtils.getNowDate());
// baseKnifeMapper.updateBaseKnife(baseKnife);
// });
//
// // 检测订单是否完成完成则出库整刀
// if (zdTask.getPlanSheet() != null && this.checkFinal(zdTask.getPlanSheet())) this.createOutTask(zdTask.getPlanSheet());
// 更新组装任务
zdTask.setStatus("2");
zdTask.setQtyOk(zdTask.getProductIdQty());
@ -510,216 +514,4 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
}
}
// 检查订单完成状态
public Boolean checkFinal(String planSheet){
// 获取订单记录
ProductionArrangements productionArrangements = productionArrangementsMapper.selectProductionArrangementsByPlanSheet(planSheet);
BaseTechnologyBom baseTechnologyBomWrapper = new BaseTechnologyBom();
baseTechnologyBomWrapper.setTechnologyCode(productionArrangements.getTechnologyCode());
List<BaseTechnologyBom> baseTechnologyBomList = baseTechnologyBomMapper.selectBaseTechnologyBomList(baseTechnologyBomWrapper);
// 判断订单锁定的物料是否足够
Map<String, Integer> coutMap = new HashMap<>();
for (BaseTechnologyBom technologyBom : baseTechnologyBomList) {
coutMap.merge(technologyBom.getKnifeCode(), technologyBom.getKnifeCount(), Integer::sum);
BaseKnife baseKnifeWrapper = new BaseKnife();
baseKnifeWrapper.setPlanSheet(planSheet);
baseKnifeWrapper.setKnifeCode(technologyBom.getKnifeCode());
List<BaseKnife> baseKnifePlanSheetList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper);
if (baseKnifePlanSheetList.size() < coutMap.get(technologyBom.getKnifeCode())) 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);
// 判断订单锁定的物料是否足够
Map<String, Integer> coutMap = new HashMap<>();
for (BaseTechnologyBom technologyBom : baseTechnologyBomList)
coutMap.merge(technologyBom.getKnifeCode(), technologyBom.getKnifeCount(), Integer::sum);
for (Map.Entry<String, Integer> item : coutMap.entrySet()) {
BaseKnife baseKnifeWrapper = new BaseKnife();
baseKnifeWrapper.setPlanSheet(planSheet);
baseKnifeWrapper.setKnifeCode(item.getKey());
List<BaseKnife> baseKnifeLockedList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper);
if (baseKnifeLockedList.size() == item.getValue()) 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);
// 修改出库状态
item.setKnifeFineState(2);
baseKnifeMapper.updateBaseKnife(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);
// 给产线控制系统发指令
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");
RequestBody requestBody = 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

@ -82,7 +82,7 @@
BK.SAFE_STOCK,
BK.STANDARD_QUANTITY,
BK.AREA_CODE,
WSA.AREA_NAME AREA_NAME,
WSA.AREA_NAME AREA_NAME,
BK.KNIFE_LIFE,
BK.KNIFE_FINE_STATE,
BK.IS_LOCKED,
@ -192,21 +192,21 @@
order by create_time desc
</select>
<!-- IS_VALID = 1 出粗则添加该指令 -->
<select id="selectBaseKnifeNotValidList" parameterType="BaseKnife" resultMap="BaseKnifeResult">
<include refid="selectBaseKnifeVo"/>
<where>
<if test="rfid != null and rfid != ''">
and RFID = #{rfid}
</if>
<if test="mbbBdMrlId != null and mbbBdMrlId != ''">
and MBB_BD_MRL_ID = #{mbbBdMrlId}
</if>
<if test="zdTaskId != null and zdTaskId != ''">
and BK.zd_task_id = #{zdTaskId}
</if>
</where>
</select>
<!-- IS_VALID = 1 出粗则添加该指令 -->
<select id="selectBaseKnifeNotValidList" parameterType="BaseKnife" resultMap="BaseKnifeResult">
<include refid="selectBaseKnifeVo"/>
<where>
<if test="rfid != null and rfid != ''">
and RFID = #{rfid}
</if>
<if test="mbbBdMrlId != null and mbbBdMrlId != ''">
and MBB_BD_MRL_ID = #{mbbBdMrlId}
</if>
<if test="zdTaskId != null and zdTaskId != ''">
and BK.zd_task_id = #{zdTaskId}
</if>
</where>
</select>
<select id="selectBaseKnifeByBaseKnifeId" parameterType="Long" resultMap="BaseKnifeResult">
<include refid="selectBaseKnifeVo"/>
@ -525,15 +525,15 @@
<insert id="batchMdItem">
insert into MD_ITEM(ITEM_ID, ITEM_CODE, ITEM_NAME, SPECIFICATION, UNIT_OF_MEASURE, ITEM_OR_PRODUCT,
ITEM_TYPE_ID, ITEM_TYPE_CODE, ITEM_TYPE_NAME, ENABLE_FLAG, SAFE_STOCK_FLAG, MIN_STOCK,
MAX_STOCK, REMARK, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY,
UPDATE_TIME, HIGH_VALUE, UNIT_NAME, MODEL_NUMBER, STANDARD_NUMBER) values
ITEM_TYPE_ID, ITEM_TYPE_CODE, ITEM_TYPE_NAME, ENABLE_FLAG, SAFE_STOCK_FLAG, MIN_STOCK,
MAX_STOCK, REMARK, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY,
UPDATE_TIME, HIGH_VALUE, UNIT_NAME, MODEL_NUMBER, STANDARD_NUMBER) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.itemId}, #{item.itemCode}, #{item.itemName}, #{item.specification}, #{item.unitOfMeasure},
#{item.itemOrProduct}, #{item.itemTypeId}, #{item.itemTypeCode}, #{item.itemTypeName}, #{item.enableFlag},
#{item.safeStockFlag}, #{item.minStock}, #{item.maxStock}, #{item.remark}, #{item.attr1}, #{item.attr2},
#{item.attr3}, #{item.attr4}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime},
#{item.highValue}, #{item.unitName}, #{item.modelNumber}, #{item.standardNumber})
#{item.itemOrProduct}, #{item.itemTypeId}, #{item.itemTypeCode}, #{item.itemTypeName}, #{item.enableFlag},
#{item.safeStockFlag}, #{item.minStock}, #{item.maxStock}, #{item.remark}, #{item.attr1}, #{item.attr2},
#{item.attr3}, #{item.attr4}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime},
#{item.highValue}, #{item.unitName}, #{item.modelNumber}, #{item.standardNumber})
</foreach>
</insert>
@ -592,7 +592,7 @@
FROM BASE_KNIFE BK
WHERE MBB_BD_MRL_ID = #{mbbBdMrlId}
AND (KNIFE_FINE_STATE = 0 OR KNIFE_FINE_STATE = 1)
AND IS_VALID = 0
AND IS_VALID = 0
</select>
<select id="selectScrapList" resultMap="BaseKnifeResult">
@ -612,4 +612,22 @@
FROM BASE_KNIFE
WHERE RFID = #{value}
</select>
<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

@ -21,6 +21,9 @@
<result property="minStock" column="min_stock"/>
<result property="maxStock" column="max_stock"/>
<result property="highValue" column="high_value"/>
<result property="length" column="length"/>
<result property="width" column="width"/>
<result property="height" column="height"/>
<result property="attr1" column="attr1"/>
<result property="attr2" column="attr2"/>
<result property="attr3" column="attr3"/>
@ -50,8 +53,13 @@
min_stock,
max_stock,
high_value,
length,
width,
height,
attr1,
attr2,
attr3,
attr4,
create_by,
create_time,
remark
@ -66,8 +74,8 @@
</if>
<if test="itemTypeId != null and itemTypeId != 0">
AND (item_type_id = #{itemTypeId} OR item_type_id in (select item_type_id
from md_item_type
where find_in_set(#{itemTypeId}, ancestors)))
from md_item_type
where find_in_set(#{itemTypeId}, ancestors)))
</if>
<if test="itemName != null and itemName != ''">
AND item_name like concat('%', #{itemName}, '%')
@ -84,38 +92,38 @@
<select id="getExeportList" parameterType="MdItem" resultMap="MdItemResult">
select i.item_id,
i.item_code,
i.item_name,
i.specification,
i.model_number,
i.unit_of_measure,
i.unit_name,
i.item_or_product,
i.item_type_id,
i.item_type_code,
i.enable_flag,
i.safe_stock_flag,
i.min_stock,
i.max_stock,
i.high_value,
i.create_by,
i.create_time,
i.remark,
CONCAT((select group_concat(item_type_name separator '/')
from md_item_type b
where FIND_IN_SET(CAST(item_type_id as CHAR), a.ancestors) > 0), '/',
a.item_type_name) as item_type_name
i.item_code,
i.item_name,
i.specification,
i.model_number,
i.unit_of_measure,
i.unit_name,
i.item_or_product,
i.item_type_id,
i.item_type_code,
i.enable_flag,
i.safe_stock_flag,
i.min_stock,
i.max_stock,
i.high_value,
i.create_by,
i.create_time,
i.remark,
CONCAT((select group_concat(item_type_name separator '/')
from md_item_type b
where FIND_IN_SET(CAST(item_type_id as CHAR), a.ancestors) > 0), '/',
a.item_type_name) as item_type_name
from md_item i
left join md_item_type a
on i.item_type_id = a.item_type_id
left join md_item_type a
on i.item_type_id = a.item_type_id
<where>
<if test="itemCode != null and itemCode != ''">
AND i.item_code like concat('%', #{itemCode}, '%')
</if>
<if test="itemTypeId != null and itemTypeId != 0">
AND (i.item_type_id = #{itemTypeId} OR i.item_type_id in (select item_type_id
from md_item_type
where find_in_set(#{itemTypeId}, ancestors)))
from md_item_type
where find_in_set(#{itemTypeId}, ancestors)))
</if>
<if test="itemName != null and itemName != ''">
AND i.item_name like concat('%', #{itemName}, '%')
@ -161,7 +169,7 @@
<insert id="insertMdItem" parameterType="MdItem" useGeneratedKeys="true" keyProperty="itemId">
insert into md_item(item_code,
item_name,
item_name,
<if test="specification != null and specification != ''">
specification,
</if>
@ -193,6 +201,15 @@
<if test="highValue != null and highValue != ''">
high_value,
</if>
<if test="length != null and length != ''">
length,
</if>
<if test="width != null and width != ''">
width,
</if>
<if test="height != null and height != ''">
height,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
@ -213,7 +230,7 @@
</if>
create_time)
values (#{itemCode},
#{itemName},
#{itemName},
<if test="specification != null and specification != ''">
#{specification},
</if>
@ -245,6 +262,15 @@
<if test="highValue != null and highValue != ''">
#{highValue},
</if>
<if test="length != null and length != ''">
#{length},
</if>
<if test="width != null and width != ''">
#{width},
</if>
<if test="height != null and height != ''">
#{height},
</if>
<if test="remark != null and remark != ''">
#{remark},
</if>
@ -314,6 +340,15 @@
<if test="highValue != null and highValue != ''">
high_value = #{highValue},
</if>
<if test="length != null and length != ''">
length = #{length},
</if>
<if test="width != null and width != ''">
width = #{width},
</if>
<if test="height != null and height != ''">
height = #{height},
</if>
<if test="remark != null and remark != ''">
remark = #{remark},
</if>
@ -323,10 +358,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

@ -79,12 +79,23 @@
<select id="selectOutNewData" resultMap="InventoryAdjustmentResult">
<include refid="InventoryAdjustmentSelectAllCol"/>
where UDF02 IS NULL
AND AD001 IS NOT NULL
AND AD002 IS NOT NULL
AND AD003 IS NOT NULL
AND AD004 IS NOT NULL
AND AD008 > 0
AND AD011 IS NOT NULL
AND AD001 IS NOT NULL
AND AD002 IS NOT NULL
AND AD003 IS NOT NULL
AND AD004 IS NOT NULL
AND AD008 > 0
AND AD011 IS NOT NULL
</select>
<select id="selectInNewData" resultMap="InventoryAdjustmentResult">
<include refid="InventoryAdjustmentSelectAllCol"/>
where UDF01 IS NULL
AND AD001 IS NOT NULL
AND AD002 IS NOT NULL
AND AD003 IS NOT NULL
AND AD004 IS NOT NULL
AND AD008 > 0
AND AD011 IS NOT NULL
</select>
<update id="updateOutDataToOld">
@ -95,4 +106,13 @@
AND AD003 = #{billDate}
AND AD004 = #{serialNumber}
</update>
<update id="updateInDataToOld">
update AP0AD
set UDF01 = 'ED'
where AD001 = #{singetsu}
AND AD002 = #{oddNumber}
AND AD003 = #{billDate}
AND AD004 = #{serialNumber}
</update>
</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

@ -85,7 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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">