物料对称修改

This commit is contained in:
lvleigang 2025-05-19 19:09:29 +08:00
parent 0e22b4b29b
commit 480e5a3729
4 changed files with 110 additions and 14 deletions

View File

@ -30,5 +30,9 @@ public interface IZjMaterielSynchronizationEventDao extends IBaseDao<ZjMaterielS
List<ZjMaterielSynchronizationEventEntity> getmeiji(ZjMaterielSynchronizationEventEntity zjMaterielSynchronizationEventEntity);
List<ZjMaterielSynchronizationEventEntity> getuser(ZjMaterielSynchronizationEventEntity user);
List<InventoryEntity> queryInventory(ZjMaterielSynchronizationEventEntity querywl);
Integer queryKh(ZjMaterielSynchronizationEventEntity querywl);
}

View File

@ -54,5 +54,19 @@ public class ZjMaterielSynchronizationEventDaoImpl extends MybatisGenericDao<ZjM
public List<ZjMaterielSynchronizationEventEntity> getuser(ZjMaterielSynchronizationEventEntity entity) {
return (List<ZjMaterielSynchronizationEventEntity>) super.selectList(getSqlIdPrifx() + "getuser",entity);
}
@Override
@DS("#entity.dataSourceCode")
public List<InventoryEntity> queryInventory(ZjMaterielSynchronizationEventEntity entity) {
return (List<InventoryEntity>) super.selectList(getSqlIdPrifx() + "queryInventory",entity);
}
@Override
@DS("#entity.dataSourceCode")
public Integer queryKh(ZjMaterielSynchronizationEventEntity entity) {
return super.getCount(getSqlIdPrifx() + "queryKh",entity);
}
}

View File

@ -13,7 +13,15 @@
ORDER BY field0018code,field0043,field0007
</select>
<select id="queryKh" resultType="java.lang.Integer"
parameterType = "com.hzya.frame.plugin.zjmaterielsynchronizationevent.entity.ZjMaterielSynchronizationEventDto">
select
count(*)
from Customer
<trim prefix="where" prefixOverrides="and">
<if test="field0034code != null and field0034code != ''"> and cCusAbbName = #{field0034code} </if>
</trim>
</select>
<select id="queryInventoryEntity" resultType="com.hzya.frame.u8.base.inventory.entity.InventoryEntity"
parameterType = "com.hzya.frame.plugin.zjmaterielsynchronizationevent.entity.ZjMaterielSynchronizationEventDto">
@ -29,7 +37,15 @@
</if>
</trim>
</select>
<select id="queryInventory" resultType="com.hzya.frame.u8.base.inventory.entity.InventoryEntity"
parameterType = "com.hzya.frame.plugin.zjmaterielsynchronizationevent.entity.ZjMaterielSynchronizationEventDto">
select
*
from Inventory
<trim prefix="where" prefixOverrides="and">
<if test="field0045 != null and field0045 != ''"> and cInvAddCode = #{field0045} </if>
</trim>
</select>
<select id="queryMaxLsh" resultType="java.lang.String"
parameterType = "com.hzya.frame.plugin.zjmaterielsynchronizationevent.entity.ZjMaterielSynchronizationEventEntity">
SELECT max(cInvCode) from Inventory

View File

@ -563,6 +563,28 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
wlcode.append(entity.getField0043code());
wlcode.append(formattedNum);
wlcode.append("1");
}else if(entity.getField0043code().startsWith("T")){
//未填写物料(T 草清单)
//货品分类(区分是草清单通过分类首位 T)
//当前分类最大流水号(编码第 2-11 是顺序号)
//整体逻辑 T物料分类 0000000001流水
if(lsh.get(entity.getField0043code()) != null){
maxnum = lsh.get(entity.getField0043code());
}
if(maxnum == null){
entity.setDataSourceCode(zju8);
entity.setQuerycode(entity.getField0043code());
String num = zjMaterielSynchronizationEventDao.queryMaxLsh(entity);
num = num.substring(entity.getField0043code().length(),entity.getField0043code().length()+10);
maxnum = num;
}
String formattedNum = null;
formattedNum = String.format("%010d", Integer.valueOf(maxnum)+1);
maxnum = String.valueOf(Integer.valueOf(maxnum)+1);
lsh.put(entity.getField0043code(),maxnum);
wlcode.append(entity.getField0043code());
wlcode.append(formattedNum);
}
}else if("修改".equals(entity.getField0018code()) || "增加替代".equals(entity.getField0018code()) || "升级".equals(entity.getField0018code())){
wlcode.append(entity.getField0005());
@ -742,10 +764,10 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
if(subStrfz.equals("9")){
str.append("序号为"+entity.getField0004()+"明细行的物料编码的封装分类编码对应不应该填写9");
}
String subStr = entity.getField0005().substring(9, 11);
String subStr = entity.getField0005().substring(10, 11);
// mw = 00 pp =000或空
//mw = 00 pp =000或
if(subStr.equals("00")){
if(subStr.equals("0")){
if(entity.getField0008code() != null && !"000".equals(entity.getField0008code())){
str.append("序号为"+entity.getField0004()+"明细行的编码和品牌不一致");
}
@ -790,10 +812,10 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
str.append("序号为"+entity.getField0004()+"明细行的物料编码的封装分类不是贴片编码对应应该填写0");
}
}
String subStr = entity.getField0005().substring(9, 11);
String subStr = entity.getField0005().substring(10, 11);
// mw = 00 pp =000或空
//mw = 00 pp =000或
if(subStr.equals("00")){
if(subStr.equals("0")){
if(entity.getField0008code() != null && !"000".equals(entity.getField0008code())){
str.append("序号为"+entity.getField0004()+"明细行的编码和品牌不一致");
}
@ -839,19 +861,58 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
//if(!subStr.equals("1")){
// str.append("序号为"+entity.getField0004()+"明细行的物料编码末尾编码应该填写1");
//}
}
}
}
//if(flag){
// if(entity.getField0045() == null || "".equals(entity.getField0045())){
// return BaseResult.getFailureMessageEntity("序号为"+entity.getField0004()+"明细行的货品代码为空");
// }
}else if(entity.getField0043code().startsWith("T")){
//货品分类(区分是软件通过分类首位A)
//当前分类最大流水号编码第6-10是顺序号
//最后1位默认1
//整体逻辑 A0110物料分类 00001流水 1默认
//A0110 00001 1
//String subStr = entity.getField0005().substring(10, 11);
//if(!subStr.equals("1")){
// str.append("序号为"+entity.getField0004()+"明细行的物料编码末尾编码应该填写1");
//}
}
}
}
if("修改".equals(entity.getField0018code())) {
if(entity.getField0045() == null || "".equals(entity.getField0045())){
str.append("序号为"+entity.getField0004()+"明细行的货品代码为空");
}else {
ZjMaterielSynchronizationEventEntity querywl = new ZjMaterielSynchronizationEventEntity();
querywl.setDataSourceCode(zju8);
querywl.setField0045(entity.getField0045());
List<InventoryEntity> inventoryEntities1 = zjMaterielSynchronizationEventDao.queryInventory(querywl);
if(inventoryEntities1 == null || inventoryEntities1.size() == 0){
str.append("序号为"+entity.getField0004()+"明细行的货品代码不存在");
}
}
}else {
if(entity.getField0045() != null && !"".equals(entity.getField0045())){//货品代码不为空时
ZjMaterielSynchronizationEventEntity querywl = new ZjMaterielSynchronizationEventEntity();
querywl.setDataSourceCode(zju8);
querywl.setField0045(entity.getField0045());
List<InventoryEntity> inventoryEntities1 = zjMaterielSynchronizationEventDao.queryInventory(querywl);
if(inventoryEntities1 != null && inventoryEntities1.size() > 0){
str.append("序号为"+entity.getField0004()+"明细行的货品代码已存在");
}
}
}
//if(flag){
// if(entity.getField0008code() == null || "".equals(entity.getField0008code())){
// return BaseResult.getFailureMessageEntity("序号为"+entity.getField0004()+"明细行的品牌为空");
// }
//}
if(entity.getField0034code() != null && !"".equals(entity.getField0034code())){//客户名
ZjMaterielSynchronizationEventEntity querywl = new ZjMaterielSynchronizationEventEntity();
querywl.setDataSourceCode(zju8);
querywl.setField0034code(entity.getField0034code());
Integer counts = zjMaterielSynchronizationEventDao.queryKh(querywl);
if(counts == null || counts == 0){
str.append("序号为"+entity.getField0004()+"明细行的客户名不存在");
}
}
//if(flag){
// if(entity.getField0034code() == null || "".equals(entity.getField0034code())){
// return BaseResult.getFailureMessageEntity("序号为"+entity.getField0004()+"明细行的客户名为空");
@ -997,11 +1058,12 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
queryCz.setDataSourceCode(zju8);
queryCz.setcInvCode(entity.getField0005());
List<InventoryEntity> queryCzList = inventoryDao.query(queryCz);
if(queryCzList != null && queryCzList.size() > 0 ){
str.append(entity.getField0005()+"在U8中已存在,请检查货品编号"+"");
if(queryCzList == null || queryCzList.size() == 0 ){
//return BaseResult.getFailureMessageEntity("序号为"+entity.getField0004()+"明细行修改的物料编码在U8中不存在");
str.append(entity.getField0005()+"在U8中不存在,请检查货品编号"+"");
}
}else {//新增/增加替代/升级
}else {//新增
xzCount++;
if(entity.getField0043code().startsWith("A")
|| entity.getField0043code().startsWith("6")