|
|
@@ -125,6 +125,15 @@ public class MESHelperServiceImpl implements MESHelperService {
|
|
|
case UpdateMakeStatus:
|
|
|
remap = UpdateMakeStatus(json);
|
|
|
break;
|
|
|
+ case GetBoxCode:
|
|
|
+ remap = GetBoxCode(json);
|
|
|
+ break;
|
|
|
+ case CollectBoxSN:
|
|
|
+ remap = CollectBoxSN(json);
|
|
|
+ break;
|
|
|
+ case PackingBox:
|
|
|
+ remap = PackingBox(json);
|
|
|
+ break;
|
|
|
default:
|
|
|
err = -1;
|
|
|
break;
|
|
|
@@ -224,6 +233,159 @@ public class MESHelperServiceImpl implements MESHelperService {
|
|
|
return relist;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取卡通箱号:对应客户端 LogicHandler.GetOutBoxCode("PACKAGE", ms_makecode, pr_code.Text, User.UserCode)
|
|
|
+ * 调用存储过程SP_GETPACKORPALLETCODE生成新箱号
|
|
|
+ */
|
|
|
+ private Map<Object, Object> GetBoxCode(JSONObject map){
|
|
|
+ Map<Object, Object> relist = new HashMap<Object, Object>();
|
|
|
+ if(map.get("iMakeCode")==null){
|
|
|
+ relist.put("oErrMessage","工单号不能为空");
|
|
|
+ return relist;
|
|
|
+ }
|
|
|
+ String Caller=map.get("iCaller")==null?"PACKAGE":map.get("iCaller").toString();
|
|
|
+ String iMakeCode=map.get("iMakeCode").toString();
|
|
|
+ String iUserCode=map.get("iUserCode")==null?"":map.get("iUserCode").toString();
|
|
|
+ List<String> list = baseDao.callProcedureWithOut("SP_GETPACKORPALLETCODE", new Object[]{
|
|
|
+ Caller,
|
|
|
+ iMakeCode,
|
|
|
+ "",
|
|
|
+ iUserCode
|
|
|
+ }, new Integer[]{1, 2, 3, 4}, new Integer[]{5});
|
|
|
+ relist.put("oBoxCode",list.get(0));
|
|
|
+ relist.put("oErrMessage",null);
|
|
|
+ return relist;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 卡通箱采集/取消采集序列号:对应客户端 LogicHandler.Packing(sn_code.Text, pa_outboxcode.Text, AutoGenBoxCode.Checked, "标准", User.UserSourceCode, User.UserCode, pr_outboxinnerqty.Text, Cancel.Checked, ...)
|
|
|
+ * iCancel=true为取消采集,底层转换成CS_PACKCARTON的IN/OUT参数(false→IN采集,true→OUT取消)
|
|
|
+ */
|
|
|
+ private Map<Object, Object> CollectBoxSN(JSONObject map){
|
|
|
+ Map<Object, Object> relist = new HashMap<Object, Object>();
|
|
|
+ if(map.get("iSN")==null){
|
|
|
+ relist.put("oErrMessage","SN不能为空");
|
|
|
+ return relist;
|
|
|
+ }
|
|
|
+ if(map.get("iOutBoxCode")==null){
|
|
|
+ relist.put("oErrMessage","箱号不能为空");
|
|
|
+ return relist;
|
|
|
+ }
|
|
|
+ if(map.get("iSourceCode")==null){
|
|
|
+ relist.put("oErrMessage","岗位资源不能为空");
|
|
|
+ return relist;
|
|
|
+ }
|
|
|
+ if(map.get("iUserCode")==null){
|
|
|
+ relist.put("oErrMessage","操作人不能为空");
|
|
|
+ return relist;
|
|
|
+ }
|
|
|
+ String iSN=map.get("iSN").toString();
|
|
|
+ String iOutBoxCode=map.get("iOutBoxCode").toString();
|
|
|
+ String iStandarqty=map.get("iStandarqty")==null?"":map.get("iStandarqty").toString();
|
|
|
+ boolean iCancel=map.get("iCancel")!=null&&"true".equalsIgnoreCase(map.get("iCancel").toString());
|
|
|
+ boolean iAutoNew=map.get("iAutoNew")!=null&&"true".equalsIgnoreCase(map.get("iAutoNew").toString());
|
|
|
+ String iType=map.get("iType")==null?"标准":map.get("iType").toString();
|
|
|
+ String iSourceCode=map.get("iSourceCode").toString();
|
|
|
+ String iUserCode=map.get("iUserCode").toString();
|
|
|
+ //箱内容量必须大于0(客户端pr_outboxinnerqty为空或0时不允许采集)
|
|
|
+ if("".equals(iStandarqty)||"0".equals(iStandarqty)){
|
|
|
+ relist.put("oErrMessage","箱内容量必须大于0");
|
|
|
+ return relist;
|
|
|
+ }
|
|
|
+ //箱号已被出货单采集或处于入库状态时不允许操作
|
|
|
+ SqlRowList rs=baseDao.queryForRowSet("select nvl(pa_iostatus,0)pa_iostatus,pa_outno from package where pa_outboxcode='"+iOutBoxCode+"'");
|
|
|
+ if(rs.next()){
|
|
|
+ String paOutno=rs.getString("pa_outno");
|
|
|
+ if(paOutno!=null&&!"".equals(paOutno)){
|
|
|
+ relist.put("oErrMessage","卡通箱"+iOutBoxCode+"已被出货单"+paOutno+"采集,不允许操作");
|
|
|
+ return relist;
|
|
|
+ }
|
|
|
+ if(!"0".equals(rs.getString("pa_iostatus"))){
|
|
|
+ relist.put("oErrMessage","卡通箱"+iOutBoxCode+"处于入库状态,不允许操作");
|
|
|
+ return relist;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //采集时校验序列号是否已装箱,取消采集不校验(客户端Cancel.Checked分支)
|
|
|
+ if(!iCancel){
|
|
|
+ Object obj=baseDao.getFieldDataByCondition("makeserial","ms_outboxcode","ms_id=(select max(ms_id) from makeserial where ms_sncode='"+iSN+"')");
|
|
|
+ String msOutBoxCode=obj==null?"":obj.toString();
|
|
|
+ if(!"".equals(msOutBoxCode)){
|
|
|
+ if(msOutBoxCode.equals(iOutBoxCode)){
|
|
|
+ relist.put("oErrMessage","序列号"+iSN+"已在本箱内");
|
|
|
+ }else{
|
|
|
+ relist.put("oErrMessage","序列号"+iSN+"已采集至箱"+msOutBoxCode);
|
|
|
+ }
|
|
|
+ return relist;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<String> list = baseDao.callProcedureWithOut("CS_PACKCARTON", new Object[]{
|
|
|
+ iSN,
|
|
|
+ iOutBoxCode,
|
|
|
+ iAutoNew?"Y":"N",
|
|
|
+ iType,
|
|
|
+ iSourceCode,
|
|
|
+ iUserCode,
|
|
|
+ iStandarqty,
|
|
|
+ iCancel?"OUT":"IN"
|
|
|
+ }, new Integer[]{1, 2, 3, 4, 5, 6, 7, 8}, new Integer[]{9, 10});
|
|
|
+ relist.put("oOutBoxCode",list.get(0));
|
|
|
+ String oErrMessage=list.get(1);
|
|
|
+ if(oErrMessage==null||"null".equals(oErrMessage)||"".equals(oErrMessage)){
|
|
|
+ oErrMessage=null;
|
|
|
+ }
|
|
|
+ relist.put("oErrMessage",oErrMessage);
|
|
|
+ return relist;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 卡通箱封箱:对应客户端 Make_PackageCollection.Packing_Click
|
|
|
+ * 校验:箱存在且未封箱→箱内无下地序列号→非称重工序→更新pa_status=1并记录命令日志
|
|
|
+ */
|
|
|
+ private Map<Object, Object> PackingBox(JSONObject map){
|
|
|
+ Map<Object, Object> relist = new HashMap<Object, Object>();
|
|
|
+ if(map.get("iOutBoxCode")==null){
|
|
|
+ relist.put("oErrMessage","箱号不能为空");
|
|
|
+ return relist;
|
|
|
+ }
|
|
|
+ String iOutBoxCode=map.get("iOutBoxCode").toString();
|
|
|
+ String iUserCode=map.get("iUserCode")==null?"":map.get("iUserCode").toString();
|
|
|
+ String iMakeCode=map.get("iMakeCode")==null?"":map.get("iMakeCode").toString();
|
|
|
+ String iSourceCode=map.get("iSourceCode")==null?"":map.get("iSourceCode").toString();
|
|
|
+ String iLineCode=map.get("iLineCode")==null?"":map.get("iLineCode").toString();
|
|
|
+ String iCaller=map.get("iCaller")==null?"Make_PackageCollection":map.get("iCaller").toString();
|
|
|
+ //箱号必须存在且未封箱(客户端nvl(pa_status,0)=0判断)
|
|
|
+ if(!baseDao.checkIf("package","pa_outboxcode='"+iOutBoxCode+"' and nvl(pa_status,0)=0")){
|
|
|
+ relist.put("oErrMessage","箱号"+iOutBoxCode+"不存在或已封箱");
|
|
|
+ return relist;
|
|
|
+ }
|
|
|
+ //箱内存在下地状态的序列号不允许封箱
|
|
|
+ SqlRowList rs=baseDao.queryForRowSet("select wm_concat(ms_sncode)sns from makeserial where ms_downstatus=-1 and ms_outboxcode='"+iOutBoxCode+"'");
|
|
|
+ if(rs.next()){
|
|
|
+ String sns=rs.getString("sns");
|
|
|
+ if(sns!=null&&!"".equals(sns)){
|
|
|
+ relist.put("oErrMessage","序列号:"+sns+"处于下地状态,箱不允许过站");
|
|
|
+ return relist;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //称重工序的箱在卡通箱称重界面处理(客户端PR_CHECKCARTONW判断)
|
|
|
+ Object checkW=baseDao.getFieldDataByCondition("package left join product on pr_code=pa_prodcode","nvl(pr_checkcartonw,'0')","pa_outboxcode='"+iOutBoxCode+"'");
|
|
|
+ if(checkW!=null&&!"0".equals(checkW.toString())){
|
|
|
+ relist.put("oErrMessage","卡通箱"+iOutBoxCode+"处于称重工序,请在卡通箱称重界面进行操作");
|
|
|
+ return relist;
|
|
|
+ }
|
|
|
+ if("".equals(iMakeCode)){
|
|
|
+ Object obj=baseDao.getFieldDataByCondition("package","pa_makecode","pa_outboxcode='"+iOutBoxCode+"'");
|
|
|
+ iMakeCode=obj==null?"":obj.toString();
|
|
|
+ }
|
|
|
+ baseDao.updateByCondition("package","pa_status=1,pa_totalqty=pa_currentqty,pa_packageqty=pa_currentqty","pa_outboxcode='"+iOutBoxCode+"'");
|
|
|
+ baseDao.execute("insert into commandlog(cl_id,cl_caller,cl_man,cl_date,cl_linecode,cl_sourcecode,cl_makecode,cl_operate," +
|
|
|
+ "cl_result,cl_sncode,cl_code) values(commandlog_seq.nextval,'"+iCaller+"','"+iUserCode+"',sysdate," +
|
|
|
+ "'"+iLineCode+"','"+iSourceCode+"','"+iMakeCode+"','装箱采集','卡通箱"+iOutBoxCode+"封箱成功','"+iOutBoxCode+"','')");
|
|
|
+ relist.put("oErrMessage",null);
|
|
|
+ relist.put("oStatus","Success");
|
|
|
+ return relist;
|
|
|
+ }
|
|
|
+
|
|
|
private Map<Object, Object> SnList(JSONObject map){
|
|
|
Map<Object, Object> relist = new HashMap<Object, Object>();
|
|
|
List<Map<Object, Object>> Err = new ArrayList<>();
|