Compare commits

..

No commits in common. "ff5d5e357ba92344132143e2738019d4f13b110d" and "35e42a5e0b0043aa86cfd6a22e36cf996a632e83" have entirely different histories.

4 changed files with 17 additions and 251 deletions

View File

@ -71,15 +71,6 @@ public class ZjMaterielSynchronizationEventEntity extends BaseEntity {
private String caccId;//
private String field0049;//认证信息
private String field0049code;//认证信息
private String querycode;//
public String getQuerycode() {
return querycode;
}
public void setQuerycode(String querycode) {
this.querycode = querycode;
}
public String getFormmain_id() {
return formmain_id;

View File

@ -34,7 +34,7 @@
parameterType = "com.hzya.frame.plugin.zjmaterielsynchronizationevent.entity.ZjMaterielSynchronizationEventEntity">
SELECT max(cInvCode) from Inventory
<trim prefix="where" prefixOverrides="and">
<if test="field0043code != null and field0043code != ''"> and cInvCCode = #{field0043code} and cInvCode like concat(#{querycode},'%') </if>
<if test="field0043code != null and field0043code != ''"> and cInvCCode = #{field0043code} and cInvCode like concat(#{field0043code},'%') </if>
</trim>
</select>

View File

@ -343,7 +343,7 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
* @return void
**/
private void saveMaterielToU8(List<ZjMaterielSynchronizationEventEntity> list,List<InventoryEntity> inventoryEntities) throws Exception {
Map<String,String> lsh = new HashMap<>();//当前流水号
Map<String,Integer> lsh = new HashMap<>();//当前流水号
List<InventoryEntity> savedata = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
@ -352,8 +352,10 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
InventorySubEntity inventorySubEntity = new InventorySubEntity();
//获取最大流水号
String maxnum = null;
Integer maxnum = null;
if(lsh.get(entity.getField0043code()) != null){
maxnum = lsh.get(entity.getField0043code());
}
StringBuffer wlcode = new StringBuffer();
//设置编码
if("新增".equals(entity.getField0018code()) ){
@ -362,7 +364,6 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
|| entity.getField0043code().equals("12418")
|| entity.getField0043code().equals("12001")
|| entity.getField0043code().equals("12003")
|| entity.getField0043code().equals("12900")
|| entity.getField0043code().equals("12005")){
//货品分类(12400-贴片电阻, 12500-贴片电容, 12418-贴片检测电阻, 12001-单面板, 12003-双面板, 12005-多层板)
//封装分类(贴片 0 , 其他 0 )
@ -374,37 +375,13 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
// 整体逻辑 12400物料分类 0贴片 002流水号 01品牌号
//12400 0 002 01
//货品分类以这几个开头的封装分类是贴片依然填0
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()+4);
maxnum = num;
maxnum = Integer.valueOf(num);
}
String formattedNum = null;
char firstChar = Character.toUpperCase(maxnum.charAt(0));
if("9999".equals(maxnum)){
maxnum = "A000";
formattedNum = "A000";
}else if(firstChar >= 'A' && firstChar <= 'Z'){
String hm = maxnum.substring(maxnum.length() - 3);
if("999".equals(hm)){
hm = "000";
firstChar++;
}else {
hm = String.format("%03d", Integer.valueOf(hm)+1);
}
maxnum = firstChar+hm;
formattedNum = firstChar+hm;
}else {
formattedNum = String.format("%04d", Integer.valueOf(maxnum)+1);
maxnum = String.valueOf(Integer.valueOf(maxnum)+1);
}
String formattedNum = String.format("%04d", ++maxnum);
lsh.put(entity.getField0043code(),maxnum);
wlcode.append(entity.getField0043code()).append(formattedNum);
if(entity.getField0008code() != null && !"".equals(entity.getField0008code())){
@ -426,48 +403,16 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
//勾选存货属性的委外计划页面的委外属性
//取消勾选勾选存货属性的委外计划页面的委外属性设置成采购
// 整体逻辑 12100物料分类 0非贴片 002流水号 01品牌号
if(lsh.get(entity.getField0043code()) != null){
if(entity.getField0017code() != null && "A贴片类".equals(entity.getField0017code())){
maxnum = lsh.get(entity.getField0043code()+9);
}else {
maxnum = lsh.get(entity.getField0043code()+0);
}
}
if(maxnum == null){
entity.setDataSourceCode(zju8);
if(entity.getField0017code() != null && "A贴片类".equals(entity.getField0017code())){
entity.setQuerycode(entity.getField0043code()+9);
}else {
entity.setQuerycode(entity.getField0043code()+0);
}
String num = zjMaterielSynchronizationEventDao.queryMaxLsh(entity);
num = num.substring(entity.getField0043code().length()+1,entity.getField0043code().length()+4);
maxnum = num;
maxnum = Integer.valueOf(num);
}
String formattedNum = null;
char firstChar = Character.toUpperCase(maxnum.charAt(0));
if("999".equals(maxnum)){
maxnum = "A00";
formattedNum = "A00";
}else if(firstChar >= 'A' && firstChar <= 'Z'){
String hm = maxnum.substring(maxnum.length() - 2);
if("99".equals(hm)){
hm = "00";
firstChar++;
}else {
hm = String.format("%02d", Integer.valueOf(hm)+1);
}
maxnum = firstChar+hm;
formattedNum = firstChar+hm;
}else {
formattedNum = String.format("%03d", Integer.valueOf(maxnum)+1);
maxnum = String.valueOf(Integer.valueOf(maxnum)+1);
}
//String formattedNum = String.format("%03d", ++maxnum);
String formattedNum = String.format("%03d", ++maxnum);
lsh.put(entity.getField0043code(),maxnum);
wlcode.append(entity.getField0043code());
if(entity.getField0017code() != null && "A贴片".equals(entity.getField0017code())){
if(entity.getField0017code() != null && "贴片".equals(entity.getField0017code())){
wlcode.append("9");
}else {
wlcode.append("0");
@ -483,42 +428,19 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
}else {
wlcode.append("00");
}
}else if(entity.getField0043code().startsWith("6") || entity.getField0043code().startsWith("7") || entity.getField0043code().startsWith("8") || entity.getField0043code().startsWith("9")){
}else if(entity.getField0043code().startsWith("6") || entity.getField0043code().startsWith("7") || entity.getField0043code().startsWith("8") || entity.getField0043code().startsWith("8")){
//货品分类(区分是否是产品通过分类首位6,7,8,9)
//当前分类最大流水号编码第6-9是顺序号
//最后2位默认11
//整体逻辑 62100物料分类 0001流水 11默认
//62100 0001 11
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()+4);
maxnum = num;
maxnum = Integer.valueOf(num);
}
String formattedNum = null;
char firstChar = Character.toUpperCase(maxnum.charAt(0));
if("9999".equals(maxnum)){
maxnum = "A000";
formattedNum = "A000";
}else if(firstChar >= 'A' && firstChar <= 'Z'){
String hm = maxnum.substring(maxnum.length() - 3);
if("999".equals(hm)){
hm = "000";
firstChar++;
}else {
hm = String.format("%03d", Integer.valueOf(hm)+1);
}
maxnum = firstChar+hm;
formattedNum = firstChar+hm;
}else {
formattedNum = String.format("%04d", Integer.valueOf(maxnum)+1);
maxnum = String.valueOf(Integer.valueOf(maxnum)+1);
}
String formattedNum = String.format("%04d", ++maxnum);
lsh.put(entity.getField0043code(),maxnum);
wlcode.append(entity.getField0043code());
wlcode.append(formattedNum);
@ -530,35 +452,13 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
//最后1位默认1
//整体逻辑 A0110物料分类 00001流水 1默认
//A0110 00001 1
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()+5);
maxnum = num;
}
String formattedNum = null;
char firstChar = Character.toUpperCase(maxnum.charAt(0));
if("99999".equals(maxnum)){
maxnum = "A0000";
formattedNum = "A0000";
}else if(firstChar >= 'A' && firstChar <= 'Z'){
String hm = maxnum.substring(maxnum.length() - 4);
if("9999".equals(hm)){
hm = "0000";
firstChar++;
}else {
hm = String.format("%04d", Integer.valueOf(hm)+1);
}
maxnum = firstChar+hm;
formattedNum = firstChar+hm;
}else {
formattedNum = String.format("%05d", Integer.valueOf(maxnum)+1);
maxnum = String.valueOf(Integer.valueOf(maxnum)+1);
maxnum = Integer.valueOf(num);
}
String formattedNum = String.format("%05d", ++maxnum);
lsh.put(entity.getField0043code(),maxnum);
wlcode.append(entity.getField0043code());
wlcode.append(formattedNum);
@ -717,106 +617,9 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
//if(entity.getField0018code() == null || "".equals(entity.getField0018code())){
// return BaseResult.getFailureMessageEntity("序号为"+entity.getField0004()+"明细行的申请原因为空");
//}
if(!"新增".equals(entity.getField0018code())){
if("修改".equals(entity.getField0018code())){
if(entity.getField0005() == null || "".equals(entity.getField0005())){
str.append("序号为"+entity.getField0004()+"明细行的货品编码为空。");
}else {
if(entity.getField0043code().equals("12400")
|| entity.getField0043code().equals("12500")
|| entity.getField0043code().equals("12418")
|| entity.getField0043code().equals("12001")
|| entity.getField0043code().equals("12003")
|| entity.getField0043code().equals("12900")
|| entity.getField0043code().equals("12005")){
//货品分类(12400-贴片电阻, 12500-贴片电容, 12418-贴片检测电阻, 12001-单面板, 12003-双面板, 12005-多层板)
//封装分类(贴片 0 , 其他 0 )
//当前分类最大流水号
//品牌(单据内填写品牌 01,未填写 00)
//是否委外
//勾选存货属性的委外计划页面的委外属性
//取消勾选勾选存货属性的委外计划页面的委外属性设置成采购
// 整体逻辑 12400物料分类 0贴片 002流水号 01品牌号
//12400 0 002 01
//货品分类以这几个开头的封装分类是贴片依然填0
String subStrfz = entity.getField0005().substring(5, 6);
if(subStrfz.equals("9")){
str.append("序号为"+entity.getField0004()+"明细行的物料编码的封装分类编码对应不应该填写9");
}
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(!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 )
//当前分类最大流水号
//品牌(单据内填写品牌 01,未填写 00)
//是否委外
//勾选存货属性的委外计划页面的委外属性
//取消勾选勾选存货属性的委外计划页面的委外属性设置成采购
// 整体逻辑 12100物料分类 0非贴片 002流水号 01品牌号
String subStrfz = entity.getField0005().substring(5, 6);
if(entity.getField0017code() != null && "A贴片类".equals(entity.getField0017code())){
if(!subStrfz.equals("9")){
str.append("序号为"+entity.getField0004()+"明细行的物料编码的封装分类为贴片编码对应应该填写9");
}
}else {
if(!subStrfz.equals("0")){
str.append("序号为"+entity.getField0004()+"明细行的物料编码的封装分类不是贴片编码对应应该填写0");
}
}
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(!subStr.equals("01")){
str.append("序号为"+entity.getField0004()+"明细行的物料编码品牌存在编码对应应该填写01");
}
}
}else {
if(!subStr.equals("00")){
str.append("序号为"+entity.getField0004()+"明细行的物料编码品牌为空应该填写00");
}
}
}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");
}
}else if(entity.getField0043code().startsWith("A")){
//货品分类(区分是软件通过分类首位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(flag){

View File

@ -42,34 +42,6 @@ public class temButtom {
@Test
public void test01() {
String maxnum = "89988";
String formattedNum = null;
char firstChar = Character.toUpperCase(maxnum.charAt(0));
if("99999".equals(maxnum)){
maxnum = "A0000";
formattedNum = "A0000";
}else if(firstChar >= 'A' && firstChar <= 'Z'){
String hm = maxnum.substring(maxnum.length() - 4);
if("9999".equals(hm)){
hm = "0000";
firstChar++;
}else {
hm = String.format("%04d", Integer.valueOf(hm)+1);
}
maxnum = firstChar+hm;
formattedNum = firstChar+hm;
}else {
formattedNum = String.format("%05d", Integer.valueOf(maxnum)+1);
maxnum = String.valueOf(Integer.valueOf(maxnum)+1);
}
System.out.println(maxnum);
System.out.println(formattedNum);
String regex = "[\uFF00-\uFF5D\uFF5F-\uFFEF]";
// 编译正则表达式
Pattern pattern = Pattern.compile(regex);