|
|
@@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.boot.jackson.JsonObjectDeserializer;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.w3c.dom.Document;
|
|
|
import org.w3c.dom.Element;
|
|
|
import org.w3c.dom.Node;
|
|
|
@@ -2051,5 +2052,160 @@ public class MESHelperServiceImpl implements MESHelperService {
|
|
|
return rmap;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Map<String, String> IQCResult(String data){
|
|
|
+ Map<String, String> hashMap = new HashMap<>();
|
|
|
+ try {
|
|
|
+ Map<Object, Object> map = BaseUtil.parseFormStoreToMap(data);
|
|
|
+ if (map.isEmpty()){
|
|
|
+ hashMap.put("code","E");
|
|
|
+ hashMap.put("msg","参数异常!");
|
|
|
+ return hashMap;
|
|
|
+ }
|
|
|
+ String iqcChechName = StringUtil.nvl(map.get("iqcChechName"), "");
|
|
|
+ if ("".equals(iqcChechName)){
|
|
|
+ hashMap.put("code","E");
|
|
|
+ hashMap.put("msg","检验单号不能为空!");
|
|
|
+ return hashMap;
|
|
|
+ }
|
|
|
+ if (!baseDao.checkIf("QUA_VerifyApplyDetail","ve_code='"+iqcChechName+"'")){
|
|
|
+ hashMap.put("code","E");
|
|
|
+ hashMap.put("msg","检验单不存在!");
|
|
|
+ return hashMap;
|
|
|
+ }
|
|
|
+ String checkResult = StringUtil.nvl(map.get("checkResult"), "");
|
|
|
+ if ("".equals(checkResult)){
|
|
|
+ hashMap.put("code","E");
|
|
|
+ hashMap.put("msg","检验结果不能为空!");
|
|
|
+ return hashMap;
|
|
|
+ }
|
|
|
+ List<String> sqls = new ArrayList<>();
|
|
|
+ if ("OK".equals(checkResult)){
|
|
|
+ sqls.add("update QUA_VerifyApplyDetail set ve_result='合格',ve_statuscode='AUDITED',ve_status='已审核' where ve_code='"+iqcChechName+"'");
|
|
|
+ }else {
|
|
|
+ sqls.add("update QUA_VerifyApplyDetail set ve_result='不合格',ve_statuscode='AUDITED',ve_status='已审核' where ve_code='"+iqcChechName+"'");
|
|
|
+ }
|
|
|
+ String boxes = StringUtil.nvl(map.get("boxes"), "[{}]");
|
|
|
+ List<Map<Object, Object>> maps = BaseUtil.parseGridStoreToMaps(boxes);
|
|
|
+ if (!maps.isEmpty()){
|
|
|
+ int detno=1;
|
|
|
+ for (Map<Object, Object> box : maps) {
|
|
|
+ String boxCode = StringUtil.nvl(box.get("lotSN"), "");
|
|
|
+ if ("".equals(boxCode)){
|
|
|
+ hashMap.put("code","E");
|
|
|
+ hashMap.put("msg","箱号不能为空!");
|
|
|
+ return hashMap;
|
|
|
+ }
|
|
|
+ double OKQty = Double.parseDouble(StringUtil.nvl(box.get("qty"), ""));
|
|
|
+ double NGQty = Double.parseDouble(StringUtil.nvl(box.get("defectQty"), ""));
|
|
|
+ sqls.add("insert into QUA_VerifyApplyDetailDet (ved_id,ved_veid,ved_detno,ved_okqty,ved_ngqty,ved_remark,ved_date,ved_testcode,ved_testman,ved_checkdate,ved_checkqty,ved_samplingqty,ved_samplingokqty,ved_samplingngqty,ved_statuscode,ved_status,ved_isok,ved_isng)" +
|
|
|
+ " select QUA_VerifyApplyDetailDet_seq.nextval,ve_id,"+detno+","+OKQty+","+NGQty+",'"+boxCode+"',ve_checkdate,em_code,ve_testman,ve_checkdate,vad_qty,vad_qty,"+OKQty+","+NGQty+",'AUDITED','已审核',0,0 from QUA_VerifyApplyDetail left join (select max(em_code) em_code,em_name from employee where em_class<>'离职' group by em_name) on ve_testman=em_name where ve_code='"+iqcChechName+"'");
|
|
|
+ detno++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ hashMap.put("code","S");
|
|
|
+ hashMap.put("msg","IQC检验单【"+iqcChechName+"】结果推送成功!");
|
|
|
+ return hashMap;
|
|
|
+ }catch (Exception e){
|
|
|
+ hashMap.put("code","E");
|
|
|
+ hashMap.put("msg","参数异常!"+e.getMessage());
|
|
|
+ return hashMap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * checkFirstResult结果回传
|
|
|
+ * @param data
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Map<String, String> checkFirstResult(String data){
|
|
|
+ Map<String, String> hashMap = new HashMap<>();
|
|
|
+ try {
|
|
|
+ Map<Object, Object> map = BaseUtil.parseFormStoreToMap(data);
|
|
|
+ if (map.isEmpty()){
|
|
|
+ hashMap.put("code","E");
|
|
|
+ hashMap.put("msg","参数异常!");
|
|
|
+ return hashMap;
|
|
|
+ }
|
|
|
+ String id = StringUtil.nvl(map.get("id"), "0");
|
|
|
+ if ("0".equals(id)){
|
|
|
+ hashMap.put("code","E");
|
|
|
+ hashMap.put("msg","检验单号不能为空!");
|
|
|
+ return hashMap;
|
|
|
+ }
|
|
|
+ if (!baseDao.checkIf("SpotCheckRecord","sr_id='"+id+"'")){
|
|
|
+ hashMap.put("code","E");
|
|
|
+ hashMap.put("msg","检验单不存在!");
|
|
|
+ return hashMap;
|
|
|
+ }
|
|
|
+ String results = StringUtil.nvl(map.get("results"), "");
|
|
|
+ if ("".equals(results)){
|
|
|
+ hashMap.put("code","E");
|
|
|
+ hashMap.put("msg","检验结果不能为空!");
|
|
|
+ return hashMap;
|
|
|
+ }
|
|
|
+ String operator = StringUtil.nvl(map.get("operator"), "");
|
|
|
+ String inspectionTime = StringUtil.nvl(map.get("inspectionTime"), "");
|
|
|
+ String time = "".equals(inspectionTime) ? DateUtil.currentDateString(Constant.YMD_HMS) : inspectionTime;
|
|
|
+ String inspectionReportType = StringUtil.nvl(map.get("inspectionReportType"), "");
|
|
|
+ baseDao.execute("update SpotCheckRecord set sr_result='"+results+"',sr_auditman='"+operator+"',sr_auditdate=to_date('"+time+"','yyyy-MM-dd hh24:mi:ss'),sr_statuscode='AUDITED',sr_status='已审核',sr_type='"+inspectionReportType+"' where sr_id='"+id+"'");
|
|
|
+ hashMap.put("code","S");
|
|
|
+ hashMap.put("msg","IQC检验单【"+id +"】结果推送成功!");
|
|
|
+ return hashMap;
|
|
|
+ }catch (Exception e){
|
|
|
+ hashMap.put("code","E");
|
|
|
+ hashMap.put("msg","参数异常!"+e.getMessage());
|
|
|
+ return hashMap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * spotCheckRecord结果回传
|
|
|
+ * @param data
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Map<String, String> spotCheckRecordResult(String data){
|
|
|
+ Map<String, String> hashMap = new HashMap<>();
|
|
|
+ try {
|
|
|
+ Map<Object, Object> map = BaseUtil.parseFormStoreToMap(data);
|
|
|
+ if (map.isEmpty()){
|
|
|
+ hashMap.put("code","E");
|
|
|
+ hashMap.put("msg","参数异常!");
|
|
|
+ return hashMap;
|
|
|
+ }
|
|
|
+ String bacthNo = StringUtil.nvl(map.get("Bacth_no"), "0");
|
|
|
+ if ("0".equals(bacthNo)){
|
|
|
+ hashMap.put("code","E");
|
|
|
+ hashMap.put("msg","检验单号不能为空!");
|
|
|
+ return hashMap;
|
|
|
+ }
|
|
|
+ if (!baseDao.checkIf("SpotCheckRecord","sr_id='"+bacthNo+"'")){
|
|
|
+ hashMap.put("code","E");
|
|
|
+ hashMap.put("msg","检验单不存在!");
|
|
|
+ return hashMap;
|
|
|
+ }
|
|
|
+ String results = StringUtil.nvl(map.get("Results"), "");
|
|
|
+ if ("".equals(results)){
|
|
|
+ hashMap.put("code","E");
|
|
|
+ hashMap.put("msg","检验结果不能为空!");
|
|
|
+ return hashMap;
|
|
|
+ }
|
|
|
+ String snCode = StringUtil.nvl(map.get("sn_code"), "");
|
|
|
+ String operator = StringUtil.nvl(map.get("Operator"), "");
|
|
|
+ String inspectionTime = StringUtil.nvl(map.get("inspectionTime"), "");
|
|
|
+ String time = "".equals(inspectionTime) ? DateUtil.currentDateString(Constant.YMD_HMS) : inspectionTime;
|
|
|
+ baseDao.execute("update SpotCheckRecord set sr_result='"+results+"',sr_auditman='"+operator+"',sr_auditdate=to_date('"+time+"','yyyy-MM-dd hh24:mi:ss'),sr_statuscode='AUDITED',sr_status='已审核',sr_remark='"+snCode+"' where sr_id='"+bacthNo+"'");
|
|
|
+ hashMap.put("code","S");
|
|
|
+ hashMap.put("msg","IQC检验单【"+bacthNo +"】结果推送成功!");
|
|
|
+ return hashMap;
|
|
|
+ }catch (Exception e){
|
|
|
+ hashMap.put("code","E");
|
|
|
+ hashMap.put("msg","参数异常!"+e.getMessage());
|
|
|
+ return hashMap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|