Commit 1557f5ac authored by dingyoujian's avatar dingyoujian

coderule

parent 97c3ca15
...@@ -127,8 +127,6 @@ public class U_coderuleController extends BaseController { ...@@ -127,8 +127,6 @@ public class U_coderuleController extends BaseController {
public Object createWosn(@RequestBody JSONObject param) { public Object createWosn(@RequestBody JSONObject param) {
String woid = param.getString("woid"); String woid = param.getString("woid");
List<CodeValueVO> codeValueVOList = DataConvert.getData2List(param.getJSONArray("codeValueList"), CodeValueVO.class); List<CodeValueVO> codeValueVOList = DataConvert.getData2List(param.getJSONArray("codeValueList"), CodeValueVO.class);
List<CodeValueVO> khValueVOList = DataConvert.getData2List(param.getJSONArray("khValueList"), CodeValueVO.class);
List<CodeValueVO> khValueVOList2 = DataConvert.getData2List(param.getJSONArray("khValueList2"), CodeValueVO.class);
Integer count = param.getInteger("count"); Integer count = param.getInteger("count");
if(StringUtils.isEmpty(woid)){ if(StringUtils.isEmpty(woid)){
setReturnMessage("任务单信息不允许为空!"); setReturnMessage("任务单信息不允许为空!");
...@@ -142,7 +140,7 @@ public class U_coderuleController extends BaseController { ...@@ -142,7 +140,7 @@ public class U_coderuleController extends BaseController {
setReturnMessage("条码信息异常,请检查!"); setReturnMessage("条码信息异常,请检查!");
return returnData(); return returnData();
} }
u_coderuleService.createWosn(woid,codeValueVOList,khValueVOList,khValueVOList2,count); u_coderuleService.createWosn(woid,codeValueVOList,count);
return ThreadContext.getReturnData(); return ThreadContext.getReturnData();
} }
......
...@@ -23,7 +23,7 @@ public interface U_coderuleService extends BaseEditService { ...@@ -23,7 +23,7 @@ public interface U_coderuleService extends BaseEditService {
public List<CodeValueVO> getCodeValueListByCrWo(String crid, Object entity); public List<CodeValueVO> getCodeValueListByCrWo(String crid, Object entity);
public void createWosn(String woid,List<CodeValueVO> codeValueVOList,List<CodeValueVO> khValueVOList,List<CodeValueVO> khValueVOList2,int count); public void createWosn(String woid,List<CodeValueVO> codeValueVOList,int count);
public CodeValueInfoVO createOneCodeByCrId(String woid, String crId, String type); public CodeValueInfoVO createOneCodeByCrId(String woid, String crId, String type);
......
...@@ -304,8 +304,14 @@ public class U_coderuleServiceImpl extends BaseEditServiceImpl implements U_code ...@@ -304,8 +304,14 @@ public class U_coderuleServiceImpl extends BaseEditServiceImpl implements U_code
return StringUtils.fillStringBeforeString(result,CRConstants.CR_FILL,len); return StringUtils.fillStringBeforeString(result,CRConstants.CR_FILL,len);
} }
/**
* 需要调整
* @param woid
* @param codeValueVOList
* @param count
*/
@Override @Override
public void createWosn(String woid,List<CodeValueVO> codeValueVOList,List<CodeValueVO> khValueVOList, List<CodeValueVO> khValueVOList2,int count){ public void createWosn(String woid,List<CodeValueVO> codeValueVOList,int count){
if (StringUtils.isEmpty(woid)) { if (StringUtils.isEmpty(woid)) {
setReturnMessage("生产订单号不能为空!"); setReturnMessage("生产订单号不能为空!");
return; return;
...@@ -333,19 +339,12 @@ public class U_coderuleServiceImpl extends BaseEditServiceImpl implements U_code ...@@ -333,19 +339,12 @@ public class U_coderuleServiceImpl extends BaseEditServiceImpl implements U_code
setReturnMessage("生产任务单物料信息异常,请重新操作!"); setReturnMessage("生产任务单物料信息异常,请重新操作!");
return; return;
} }
if(StringUtils.isEmpty(wlxx.getWosngzid())){ if(StringUtils.isEmpty(wlxx.getSnruleid())){
setReturnMessage("请先维护当前产品的产品条码规则!"); setReturnMessage("请先维护当前产品的产品条码规则!");
return; return;
} }
String crCode = wlxx.getWosngzid(); String crCode = wlxx.getSnruleid();
String khcrCode = wlxx.getKhsngzid();
String khcrCode2 = wlxx.getKhsngzidby1();
if(StringUtils.isNotEmpty(khcrCode) && (khValueVOList == null || khValueVOList.size() == 0)){
setReturnMessage("客户条码信息异常,请重新操作!");
return;
}
String format = ""; String format = "";
String prefix = ""; String prefix = "";
...@@ -364,53 +363,7 @@ public class U_coderuleServiceImpl extends BaseEditServiceImpl implements U_code ...@@ -364,53 +363,7 @@ public class U_coderuleServiceImpl extends BaseEditServiceImpl implements U_code
} }
} }
String khformat = "";
String khprefix = "";
String khsngz = "";
Integer khlen = 0;
if(khValueVOList != null && khValueVOList.size() > 0){
for(CodeValueVO codeValueVO:khValueVOList){
if(BooleanEnum.equalsYes(codeValueVO.getContainsn())){
khprefix = khprefix + codeValueVO.getValue();
}
if(!BooleanEnum.equalsYes(codeValueVO.getSnflag())){
khformat = khformat + codeValueVO.getValue();
}else{
khformat = khformat + "%s";
khsngz = codeValueVO.getSngz();
khlen = codeValueVO.getLen();
}
}
}
String khformat2 = "";
String khprefix2 = "";
String khsngz2 = "";
Integer khlen2 = 0;
if(khValueVOList2 != null && khValueVOList2.size() > 0){
for(CodeValueVO codeValueVO:khValueVOList2){
if(BooleanEnum.equalsYes(codeValueVO.getContainsn())){
khprefix2 = khprefix2 + codeValueVO.getValue();
}
if(!BooleanEnum.equalsYes(codeValueVO.getSnflag())){
khformat2 = khformat2 + codeValueVO.getValue();
}else{
khformat2 = khformat2 + "%s";
khsngz2 = codeValueVO.getSngz();
khlen2 = codeValueVO.getLen();
}
}
}
int order = commonService.getSequence(CRTableTypeEnum.WOSN.getId() + crCode, prefix, count); int order = commonService.getSequence(CRTableTypeEnum.WOSN.getId() + crCode, prefix, count);
int khorder = 0;
int khorder2 = 0;
if(StringUtils.isNotEmpty(khcrCode)){
khorder = commonService.getSequence(CRTableTypeEnum.KHSN.getId() + khcrCode, khprefix, count);
}
if(StringUtils.isNotEmpty(khcrCode2)){
khorder2 = commonService.getSequence(CRTableTypeEnum.KHB1SN.getId() + khcrCode2, khprefix2, count);
}
List<Wosn> list = new ArrayList<>(); List<Wosn> list = new ArrayList<>();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
HzWosn wosn = new HzWosn(); HzWosn wosn = new HzWosn();
...@@ -419,19 +372,6 @@ public class U_coderuleServiceImpl extends BaseEditServiceImpl implements U_code ...@@ -419,19 +372,6 @@ public class U_coderuleServiceImpl extends BaseEditServiceImpl implements U_code
wosn.setCode(String.format(format, sn)); wosn.setCode(String.format(format, sn));
wosn.setCodeflid(CRTableTypeEnum.WOSN.getId() + crCode); wosn.setCodeflid(CRTableTypeEnum.WOSN.getId() + crCode);
wosn.setCodeprefix(prefix); wosn.setCodeprefix(prefix);
if(StringUtils.isNotEmpty(khcrCode)){
String khsn = getCRSnValue(khsngz,khorder + i, khlen);
wosn.setKhcode(String.format(khformat,khsn));
wosn.setKhcodeflid(CRTableTypeEnum.KHSN.getId() + khcrCode);
wosn.setKhcodeprefix(khprefix);
}
if(StringUtils.isNotEmpty(khcrCode2)){
String khsn2 = getCRSnValue(khsngz2,khorder2 + i, khlen2);
wosn.setKhcodeby1(String.format(khformat2,khsn2));
wosn.setKhcodeby1flid(CRTableTypeEnum.KHB1SN.getId() + khcrCode2);
wosn.setKhcodeby1prefix(khprefix2);
}
list.add(wosn); list.add(wosn);
} }
u_coderuleDao.batchAdd(list); u_coderuleDao.batchAdd(list);
...@@ -545,26 +485,26 @@ public class U_coderuleServiceImpl extends BaseEditServiceImpl implements U_code ...@@ -545,26 +485,26 @@ public class U_coderuleServiceImpl extends BaseEditServiceImpl implements U_code
String crCode = ""; String crCode = "";
String flid = ""; String flid = "";
if(type.equalsIgnoreCase(CRTableTypeEnum.WOSN.getId())){ if(type.equalsIgnoreCase(CRTableTypeEnum.WOSN.getId())){
crCode = wlxx.getWosngzid(); crCode = wlxx.getSnruleid();
if(StringUtils.isEmpty(crCode)){ if(StringUtils.isEmpty(crCode)){
setReturnMessage("请先维护当前产品的产品条码规则!"); setReturnMessage("请先维护当前产品的产品条码规则!");
return null; return null;
} }
flid = CRTableTypeEnum.WOSN.getId() + crCode; flid = CRTableTypeEnum.WOSN.getId() + crCode;
} }
if(type.equalsIgnoreCase(CRTableTypeEnum.KHSN.getId())){ // if(type.equalsIgnoreCase(CRTableTypeEnum.KHSN.getId())){
crCode = wlxx.getKhsngzid(); // crCode = wlxx.getKhsngzid();
if(StringUtils.isEmpty(crCode)){ // if(StringUtils.isEmpty(crCode)){
setReturnMessage("请先维护当前产品的客户条码规则!"); // setReturnMessage("请先维护当前产品的客户条码规则!");
return null; // return null;
} // }
flid = CRTableTypeEnum.KHSN.getId() + crCode; // flid = CRTableTypeEnum.KHSN.getId() + crCode;
} // }
if(StringUtils.isEmpty(crCode)){ if(StringUtils.isEmpty(crCode)){
setReturnMessage("条码规则信息异常!"); setReturnMessage("条码规则信息异常!");
return null; return null;
} }
List<CodeValueVO> codeValueVOList = getCodeValueListByCrWo(wlxx.getWosngzid(), wo); List<CodeValueVO> codeValueVOList = getCodeValueListByCrWo(crCode, wo);
String prefix = ""; String prefix = "";
for(CodeValueVO codeValueVO:codeValueVOList){ for(CodeValueVO codeValueVO:codeValueVOList){
...@@ -605,6 +545,16 @@ public class U_coderuleServiceImpl extends BaseEditServiceImpl implements U_code ...@@ -605,6 +545,16 @@ public class U_coderuleServiceImpl extends BaseEditServiceImpl implements U_code
createWlsn(wlid, codeValueVOList, count, CRTableTypeEnum.GJSN.getId(),"",WlsnDjlyEnum.ZGJWL.getId(),""); createWlsn(wlid, codeValueVOList, count, CRTableTypeEnum.GJSN.getId(),"",WlsnDjlyEnum.ZGJWL.getId(),"");
} }
/**
* 生成物料件,可以暂时保留,0215
* @param wlid
* @param codeValueVOList
* @param count
* @param type
* @param djly
* @param lydjid
* @param wlph
*/
@Override @Override
public void createWlsn(String wlid, List<CodeValueVO> codeValueVOList, int count, String type,String djly,String lydjid,String wlph){ public void createWlsn(String wlid, List<CodeValueVO> codeValueVOList, int count, String type,String djly,String lydjid,String wlph){
if (StringUtils.isEmpty(wlid)) { if (StringUtils.isEmpty(wlid)) {
...@@ -629,12 +579,12 @@ public class U_coderuleServiceImpl extends BaseEditServiceImpl implements U_code ...@@ -629,12 +579,12 @@ public class U_coderuleServiceImpl extends BaseEditServiceImpl implements U_code
setReturnMessage("物料信息异常,请重新操作!"); setReturnMessage("物料信息异常,请重新操作!");
return; return;
} }
if(StringUtils.isEmpty(wlxx.getWosngzid())){ if(StringUtils.isEmpty(wlxx.getSnruleid())){
setReturnMessage("请先维护当前产品的产品条码规则!"); setReturnMessage("请先维护当前产品的产品条码规则!");
return; return;
} }
String crCode = wlxx.getWosngzid(); String crCode = wlxx.getSnruleid();
String format = ""; String format = "";
String prefix = ""; String prefix = "";
...@@ -679,6 +629,14 @@ public class U_coderuleServiceImpl extends BaseEditServiceImpl implements U_code ...@@ -679,6 +629,14 @@ public class U_coderuleServiceImpl extends BaseEditServiceImpl implements U_code
u_coderuleDao.batchAdd(list); u_coderuleDao.batchAdd(list);
} }
/**
* 确定生成序列号,0215
* @param crId
* @param codeValueVOList
* @param type
* @param count
* @return
*/
@Override @Override
public List<CodeValueInfoVO> getSnListByCRValue(String crId, List<CodeValueVO> codeValueVOList, String type, int count){ public List<CodeValueInfoVO> getSnListByCRValue(String crId, List<CodeValueVO> codeValueVOList, String type, int count){
if (NumberUtils.lessEqual(count, 0)) { if (NumberUtils.lessEqual(count, 0)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment