Compare commits

..

No commits in common. "3af8d9d687a01194d51eb731c615b96fbda69b1a" and "ff5d5e357ba92344132143e2738019d4f13b110d" have entirely different histories.

6 changed files with 212 additions and 1368 deletions

View File

@ -30,13 +30,5 @@ 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);
Integer queryXM(ZjMaterielSynchronizationEventEntity querywl);
List<ZjMaterielSynchronizationEventEntity> getUser(ZjMaterielSynchronizationEventEntity user);
}

View File

@ -54,30 +54,5 @@ 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<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);
}
@Override
@DS("#entity.dataSourceCode")
public Integer queryXM(ZjMaterielSynchronizationEventEntity entity) {
return super.getCount(getSqlIdPrifx() + "queryXM",entity);
}
}

View File

@ -72,24 +72,6 @@ public class ZjMaterielSynchronizationEventEntity extends BaseEntity {
private String field0049;//认证信息
private String field0049code;//认证信息
private String querycode;//
private String affairId;//
private String userName;//
public String getAffairId() {
return affairId;
}
public void setAffairId(String affairId) {
this.affairId = affairId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getQuerycode() {
return querycode;

View File

@ -13,24 +13,8 @@
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 cCusDefine7 = #{field0034code} </if>
</trim>
</select>
<select id="queryXM" resultType="java.lang.Integer"
parameterType = "com.hzya.frame.plugin.zjmaterielsynchronizationevent.entity.ZjMaterielSynchronizationEventDto">
select
count(*)
from fitemss97
<trim prefix="where" prefixOverrides="and">
<if test="field0039 != null and field0039 != ''"> and citemcode = #{field0039} </if>
</trim>
</select>
<select id="queryInventoryEntity" resultType="com.hzya.frame.u8.base.inventory.entity.InventoryEntity"
parameterType = "com.hzya.frame.plugin.zjmaterielsynchronizationevent.entity.ZjMaterielSynchronizationEventDto">
select
@ -45,15 +29,7 @@
</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
@ -88,7 +64,6 @@
'3731163912961082997', -- field0018
'612018623748066455', -- field0019
'-5893688452217157155', -- field0020
'-5893688452217157155', -- field0020
'-8682849565428789486', -- field0033
'3282520586982344070', -- field0034
'1314047672872420014', -- field0040
@ -106,15 +81,5 @@
from v_user_view_all
where id = #{id}
</select>
<select id="getUser" resultType="com.hzya.frame.plugin.zjmaterielsynchronizationevent.entity.ZjMaterielSynchronizationEventEntity"
parameterType = "com.hzya.frame.plugin.zjmaterielsynchronizationevent.entity.ZjMaterielSynchronizationEventEntity">
SELECT name as userName from v_user_view_all where staffID in (
SELECT MEMBER_ID from CTP_AFFAIR WHERE id = #{affairId}
)
</select>
</mapper>

View File

@ -24,9 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import java.lang.reflect.InvocationTargetException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@ -79,7 +77,6 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
JSONObject reqJson = new JSONObject();
JSONObject jsonStr = requestJson.getJSONObject("jsonStr");
JSONObject businessDataStr = jsonStr.getJSONObject("businessDataStr");
String affairId = jsonStr.getString("affairId");
String formAppId = jsonStr.getString("formAppId");
String eventType = jsonStr.getString("eventType");
switch (eventType) {
@ -124,7 +121,7 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
}
//组装数据保存数据
try {
saveMaterielToU8(list1,inventoryEntities1,affairId);
saveMaterielToU8(list1,inventoryEntities1);
//回写U8生成的编码
updateOaCode(list1);
}catch (Exception e){
@ -345,7 +342,7 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
* @param list
* @return void
**/
private void saveMaterielToU8(List<ZjMaterielSynchronizationEventEntity> list,List<InventoryEntity> inventoryEntities,String affairId) throws Exception {
private void saveMaterielToU8(List<ZjMaterielSynchronizationEventEntity> list,List<InventoryEntity> inventoryEntities) throws Exception {
Map<String,String> lsh = new HashMap<>();//当前流水号
List<InventoryEntity> savedata = new ArrayList<>();
@ -566,28 +563,6 @@ 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());
@ -613,15 +588,7 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
inventorySubEntity.setcInvSubCode(entity.getField0005());
inventorySubEntity = iInventorySubService.getInvSub(inventorySubEntity);
inventorySubEntity.setDataSourceCode(zju8);
// 变更日期 变更人
inventoryEntity.setdModifyDate(new Date());//变更日期
ZjMaterielSynchronizationEventEntity user = new ZjMaterielSynchronizationEventEntity();
user.setDataSourceCode(zjoa);
user.setAffairId(affairId);
List<ZjMaterielSynchronizationEventEntity> usersa = zjMaterielSynchronizationEventDao.getUser(user);
if(usersa != null && usersa.size() > 0){
inventoryEntity.setcModifyPerson(usersa.get(0).getUserName());//变更人
}
}else {
for (int i1 = 0; i1 < inventoryEntities.size(); i1++) {
if(inventoryEntities.get(i1).getcInvCode().equals(entity.getField0043code())){
@ -637,19 +604,6 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
inventorySubEntity.setcInvSubCode(entity.getField0043code());
inventorySubEntity = iInventorySubService.getInvSub(inventorySubEntity);
inventorySubEntity.setDataSourceCode(zju8);
// 建档日期 启用日期 建档人
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
inventorySubEntity.setdInvCreateDatetime(sdf.format(new Date()));//建档日期
inventoryEntity.setdSDate(new Date());//启用日期
ZjMaterielSynchronizationEventEntity user = new ZjMaterielSynchronizationEventEntity();
user.setDataSourceCode(zjoa);
user.setAffairId(affairId);
List<ZjMaterielSynchronizationEventEntity> usersa = zjMaterielSynchronizationEventDao.getUser(user);
if(usersa != null && usersa.size() > 0){
inventoryEntity.setcCreatePerson(usersa.get(0).getUserName());//建档人
}
}
inventoryExtEntity.setcInvCode(wlcode.toString());
@ -788,33 +742,22 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
if(subStrfz.equals("9")){
str.append("序号为"+entity.getField0004()+"明细行的物料编码的封装分类编码对应不应该填写9");
}
String subStr = entity.getField0005().substring(10, 11);
// mw = 00 pp =000或空
//mw = 00 pp =000或
if(subStr.equals("0")){
if(entity.getField0008code() != null && !"000".equals(entity.getField0008code())){
str.append("序号为"+entity.getField0004()+"明细行的编码和品牌不一致");
String subStr = entity.getField0005().substring(9, 11);
if(entity.getField0008code() != null && !"".equals(entity.getField0008code())){
if("000".equals(entity.getField0008code())){
if(!subStr.equals("00")){
str.append("序号为"+entity.getField0004()+"明细行的物料编码品牌为000编码对应应该填写00");
}
}else {
if(entity.getField0008code() == null || "000".equals(entity.getField0008code())){
str.append("序号为"+entity.getField0004()+"明细行的编码和品牌不一致");
if(!subStr.equals("01")){
str.append("序号为"+entity.getField0004()+"明细行的物料编码品牌存在编码对应应该填写01");
}
}
}else {
if(!subStr.equals("00")){
str.append("序号为"+entity.getField0004()+"明细行的物料编码品牌为空应该填写00");
}
}
//if(entity.getField0008code() != null && !"".equals(entity.getField0008code())){
// if("000".equals(entity.getField0008code())){
// if(!subStr.equals("00")){
// str.append("序号为"+entity.getField0004()+"明细行的物料编码品牌为000编码对应应该填写00");
// }
// }else {
// if(!subStr.equals("01")){
// str.append("序号为"+entity.getField0004()+"明细行的物料编码品牌存在编码对应应该填写01");
// }
// }
//}else {
// if(!subStr.equals("00")){
// str.append("序号为"+entity.getField0004()+"明细行的物料编码品牌为空应该填写00");
// }
//}
}else if(entity.getField0043code().startsWith("1") || entity.getField0043code().startsWith("4") || entity.getField0043code().startsWith("5")){
//货品分类(区分是否是原材料通过分类首位1,4,5)
//封装分类(贴片 9 , 其他 0 )
@ -836,44 +779,32 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
str.append("序号为"+entity.getField0004()+"明细行的物料编码的封装分类不是贴片编码对应应该填写0");
}
}
String subStr = entity.getField0005().substring(10, 11);
// mw = 00 pp =000或空
//mw = 00 pp =000或
if(subStr.equals("0")){
if(entity.getField0008code() != null && !"000".equals(entity.getField0008code())){
str.append("序号为"+entity.getField0004()+"明细行的编码和品牌不一致");
String subStr = entity.getField0005().substring(9, 11);
if(entity.getField0008code() != null && !"".equals(entity.getField0008code())){
if("000".equals(entity.getField0008code())){
if(!subStr.equals("00")){
str.append("序号为"+entity.getField0004()+"明细行的物料编码品牌为000编码对应应该填写00");
}
}else {
if(entity.getField0008code() == null || "000".equals(entity.getField0008code())){
str.append("序号为"+entity.getField0004()+"明细行的编码和品牌不一致");
if(!subStr.equals("01")){
str.append("序号为"+entity.getField0004()+"明细行的物料编码品牌存在编码对应应该填写01");
}
}
}else {
if(!subStr.equals("00")){
str.append("序号为"+entity.getField0004()+"明细行的物料编码品牌为空应该填写00");
}
}
//if(entity.getField0008code() != null && !"".equals(entity.getField0008code())){
// if("000".equals(entity.getField0008code())){
// if(!subStr.equals("00")){
// str.append("序号为"+entity.getField0004()+"明细行的物料编码品牌为000编码对应应该填写00");
// }
// }else {
// if(!subStr.equals("01")){
// str.append("序号为"+entity.getField0004()+"明细行的物料编码品牌存在编码对应应该填写01");
// }
// }
//}else {
// if(!subStr.equals("00")){
// str.append("序号为"+entity.getField0004()+"明细行的编码和品牌不一致");
// }
//}
}else if(entity.getField0043code().startsWith("6") || entity.getField0043code().startsWith("7") || entity.getField0043code().startsWith("8") || entity.getField0043code().startsWith("9")){
//货品分类(区分是否是产品通过分类首位6,7,8,9)
//当前分类最大流水号编码第6-9是顺序号
//最后2位默认11
//整体逻辑 62100物料分类 0001流水 11默认
//62100 0001 11
//String subStr = entity.getField0005().substring(9, 11);
//if(!subStr.equals("11")){
// str.append("序号为"+entity.getField0004()+"明细行的物料编码末尾编码应该填写11");
//}
String subStr = entity.getField0005().substring(9, 11);
if(!subStr.equals("11")){
str.append("序号为"+entity.getField0004()+"明细行的物料编码末尾编码应该填写11");
}
}else if(entity.getField0043code().startsWith("A")){
//货品分类(区分是软件通过分类首位A)
@ -881,67 +812,23 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
//最后1位默认1
//整体逻辑 A0110物料分类 00001流水 1默认
//A0110 00001 1
//String subStr = entity.getField0005().substring(10, 11);
//if(!subStr.equals("1")){
// str.append("序号为"+entity.getField0004()+"明细行的物料编码末尾编码应该填写1");
String subStr = entity.getField0005().substring(10, 11);
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.getField0005() != null && !"".equals(entity.getField0005())){
str.append("序号为"+entity.getField0004()+"明细行的申请原因与实际不符。");
}
}
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()+"明细行的客户名为空");
@ -952,16 +839,11 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
// return BaseResult.getFailureMessageEntity("序号为"+entity.getField0004()+"明细行的优选等级为空");
// }
//}
// 开发号
if(entity.getField0039() != null && !"".equals(entity.getField0039())){//开发号
ZjMaterielSynchronizationEventEntity querywl = new ZjMaterielSynchronizationEventEntity();
querywl.setDataSourceCode(zju8);
querywl.setField0039(entity.getField0039());
Integer counts = zjMaterielSynchronizationEventDao.queryXM(querywl);
if(counts == null || counts == 0){
str.append("序号为"+entity.getField0004()+"明细行的开发号不存在");
}
}
//if(flag){
// if(entity.getField0039() == null || "".equals(entity.getField0039())){
// return BaseResult.getFailureMessageEntity("序号为"+entity.getField0004()+"明细行的开发号为空");
// }
//}
//if(flag){
// if(entity.getField0042code() == null || "".equals(entity.getField0042code())){
// return BaseResult.getFailureMessageEntity("序号为"+entity.getField0004()+"明细行的物料属性为空");
@ -976,7 +858,7 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
if(entity.getField0005() != null && !"".equals(entity.getField0005())
&& entity.getField0045() != null && !"".equals(entity.getField0045())){
if(!entity.getField0005().equals(entity.getField0045())){
//str.append("序号为"+entity.getField0004()+"明细行的物料编码和货品代码不一致。");
str.append("序号为"+entity.getField0004()+"明细行的物料编码和货品代码不一致。");
//return BaseResult.getFailureMessageEntity("序号为"+entity.getField0004()+"明细行的物料编码和货品代码不一致");
}
@ -1085,6 +967,7 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
str.append(entity.getField0005()+"在U8中不存在,请检查货品编号"+"");
}
}else if("增加替代".equals(entity.getField0018code()) || "升级".equals(entity.getField0018code())){
//查询u8物料
InventoryEntity queryCz = new InventoryEntity();
@ -1092,10 +975,10 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
queryCz.setcInvCode(entity.getField0005());
List<InventoryEntity> queryCzList = inventoryDao.query(queryCz);
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")

File diff suppressed because one or more lines are too long