修改
This commit is contained in:
@@ -63,19 +63,22 @@ public class SparePartServiceImpl implements SparePartService {
|
||||
if (StrUtil.isEmpty(sparepart_only_id)) {
|
||||
throw new PdaRequestException("备品备件不能为空!");
|
||||
}
|
||||
|
||||
/*
|
||||
JSONObject spare_bom = WQLObject.getWQLObject("EM_BI_EquipmentSpareBOM").query("sparepart_only_id = '" + sparepart_only_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(spare_bom)) {
|
||||
throw new PdaRequestException("该备件未查询到设备档案BOM备件表!");
|
||||
}
|
||||
|
||||
String device_id = spare_bom.getString("devicerecord_id");
|
||||
String device_id = spare_bom.getString("devicerecord_id");*/
|
||||
|
||||
JSONObject row = WQL.getWO("QPDAEM_BI_SPAREPART").addParam("flag", "1").addParam("device_id", device_id).addParam("sparepart_only_id", sparepart_only_id).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jo)) {
|
||||
if (ObjectUtil.isEmpty(spare_bom)) {
|
||||
throw new PdaRequestException("该备件未查询到相关领用出库记录!");
|
||||
}
|
||||
//查询是否已经入库
|
||||
JSONObject ivt = WQLObject.getWQLObject("em_bi_devicesparepartivt").query("sparepart_only_id = '"+sparepart_only_id+"'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(ivt)){
|
||||
throw new PdaRequestException("该备件已经入库!");
|
||||
}
|
||||
JSONObject row = WQL.getWO("QPDAEM_BI_SPAREPART").addParam("flag", "1").addParam("sparepart_only_id", sparepart_only_id).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(row)) {
|
||||
throw new PdaRequestException("该备件未查询到相关领用出库记录!");
|
||||
}
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
@@ -255,7 +258,7 @@ public class SparePartServiceImpl implements SparePartService {
|
||||
String iostorinvdtl_id = jo.getString("iostorinvdtl_id");
|
||||
String io_flag = jo.getString("io_flag");
|
||||
|
||||
JSONObject dtl = WQLObject.getWQLObject("EM_BI_IOStorInvDtl").query("iostorinvdtl_id = '"+iostorinvdtl_id+"'").uniqueResult(0);
|
||||
JSONObject dtl = WQLObject.getWQLObject("EM_BI_IOStorInvDtl").query("iostorinvdtl_id = '" + iostorinvdtl_id + "'").uniqueResult(0);
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "4");
|
||||
map.put("sparepart_only_id", sparepart_only_id);
|
||||
@@ -263,13 +266,13 @@ public class SparePartServiceImpl implements SparePartService {
|
||||
|
||||
JSONObject row = WQL.getWO("QPDAEM_BI_SPAREPART").addParamMap(map).process().uniqueResult(0);
|
||||
|
||||
if (io_flag.equals("1") && ObjectUtil.isEmpty(row)){
|
||||
if (io_flag.equals("1") && ObjectUtil.isEmpty(row)) {
|
||||
//如果出库的话查询库存记录表
|
||||
map.put("flag", "8");
|
||||
map.put("material_id",dtl.getString("material_id"));
|
||||
map.put("material_id", dtl.getString("material_id"));
|
||||
row = WQL.getWO("QPDAEM_BI_SPAREPART").addParamMap(map).process().uniqueResult(0);
|
||||
}
|
||||
if (ObjectUtil.isEmpty(row)){
|
||||
if (ObjectUtil.isEmpty(row)) {
|
||||
throw new PdaRequestException("请扫描或输入正确的备件唯一码!");
|
||||
}
|
||||
JSONObject returnjo = new JSONObject();
|
||||
@@ -296,7 +299,7 @@ public class SparePartServiceImpl implements SparePartService {
|
||||
JSONArray ja = new JSONArray();
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
if (StrUtil.isEmpty(row.getString("iostorinvdis_id"))){
|
||||
if (StrUtil.isEmpty(row.getString("iostorinvdis_id"))) {
|
||||
JSONObject dis_jo = new JSONObject();
|
||||
dis_jo.put("iostorinvdis_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
dis_jo.put("iostorinv_id", form.getString("iostorinv_id"));
|
||||
@@ -318,11 +321,11 @@ public class SparePartServiceImpl implements SparePartService {
|
||||
dis_jo.put("sparepart_only_id", row.getString("sparepart_only_id"));
|
||||
WQLObject.getWQLObject("EM_BI_IOStorInvDis").insert(dis_jo);
|
||||
ja.add(dis_jo);
|
||||
}else {
|
||||
} else {
|
||||
ja.add(row);
|
||||
}
|
||||
}
|
||||
jo.put("rows",ja);
|
||||
jo.put("rows", ja);
|
||||
sparePartOutService.disConfirm(jo);
|
||||
}
|
||||
|
||||
@@ -351,7 +354,7 @@ public class SparePartServiceImpl implements SparePartService {
|
||||
}
|
||||
|
||||
JSONObject content = new JSONObject();
|
||||
content.put("rows",rows);
|
||||
content.put("rows", rows);
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("rows", rows);
|
||||
@@ -586,7 +589,7 @@ public class SparePartServiceImpl implements SparePartService {
|
||||
}
|
||||
|
||||
JSONObject content = new JSONObject();
|
||||
content.put("rows",rows);
|
||||
content.put("rows", rows);
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("content", content);
|
||||
@@ -771,11 +774,11 @@ public class SparePartServiceImpl implements SparePartService {
|
||||
String device_code = jo.getString("device_code");
|
||||
String run_date = jo.getString("run_date");
|
||||
|
||||
if (StrUtil.isEmpty(device_code)){
|
||||
if (StrUtil.isEmpty(device_code)) {
|
||||
throw new PdaRequestException("输入的设备编码不能为空!");
|
||||
}
|
||||
|
||||
JSONObject content = WQL.getWO("QPDAEM_BI_SPAREPART").addParam("flag", "7").addParam("device_code", device_code).addParam("run_date",run_date).process().uniqueResult(0);
|
||||
JSONObject content = WQL.getWO("QPDAEM_BI_SPAREPART").addParam("flag", "7").addParam("device_code", device_code).addParam("run_date", run_date).process().uniqueResult(0);
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("content", content);
|
||||
@@ -847,7 +850,7 @@ public class SparePartServiceImpl implements SparePartService {
|
||||
double product_qty = jo.getDoubleValue("product_qty"); //生产总量
|
||||
double nok_qty = jo.getDoubleValue("nok_qty"); //不合格数
|
||||
double oee_value = jo.getDoubleValue("oee_value"); //不合格数
|
||||
if (ObjectUtil.isEmpty(jo.getString("oee_value"))){
|
||||
if (ObjectUtil.isEmpty(jo.getString("oee_value"))) {
|
||||
throw new PdaRequestException("oee不能为空!");
|
||||
}
|
||||
double theory_beat = jsonFile.getDoubleValue("theory_beat"); // 理论节拍
|
||||
|
||||
@@ -72,7 +72,6 @@
|
||||
LEFT JOIN em_bi_equipmentfile file ON file.devicerecord_id = mst.device_id
|
||||
WHERE
|
||||
dis.sparepart_only_id = 输入.sparepart_only_id
|
||||
AND mst.device_id = 输入.device_id
|
||||
AND mst.bill_type = '010901'
|
||||
AND mst.bill_status = '99'
|
||||
AND mst.is_delete = '0'
|
||||
|
||||
@@ -120,4 +120,14 @@ public class SparePartInController {
|
||||
sparePartInService.confirm(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("导入视图数据")
|
||||
@ApiOperation("导入视图数据")
|
||||
//@PreAuthorize("@el.check('pcsIfPurchaseorderproc:del')")
|
||||
@PutMapping("/importData")
|
||||
public ResponseEntity<Object> importData(@RequestBody Map whereJson) {
|
||||
sparePartInService.importData(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ public interface SparePartInService {
|
||||
|
||||
void confirm(Map whereJson);
|
||||
|
||||
void importData(Map whereJson);
|
||||
|
||||
JSONArray getDisDtl(JSONObject whereJson);
|
||||
|
||||
void divStruct(JSONObject whereJson);
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.ext.erp.service.WmsToErpService;
|
||||
import org.nl.modules.security.service.dto.JwtUserDto;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
@@ -44,6 +45,8 @@ public class SparePartInServiceImpl implements SparePartInService {
|
||||
|
||||
@Autowired
|
||||
private final StorattrService storattrService;
|
||||
@Autowired
|
||||
private WmsToErpService wmsToErpService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> pageQuery(Map whereJson, Pageable page) {
|
||||
@@ -401,6 +404,21 @@ public class SparePartInServiceImpl implements SparePartInService {
|
||||
this.confirmMst((String) whereJson.get("iostorinv_id"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importData(Map whereJson) {
|
||||
ArrayList<String> arr = (ArrayList<String>) whereJson.get("createTime");
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
if (arr != null && arr.size() != 0) {
|
||||
if (StrUtil.isNotEmpty(arr.get(0))) {
|
||||
map.put("begin_time", arr.get(0));
|
||||
}
|
||||
if (StrUtil.isNotEmpty(arr.get(1))) {
|
||||
map.put("end_time", arr.get(1));
|
||||
}
|
||||
}
|
||||
wmsToErpService.getPurchaseInInfo(map);
|
||||
}
|
||||
|
||||
public void confirmMst(String id) {
|
||||
WQLObject mst_wql = WQLObject.getWQLObject("EM_BI_IOStorInv");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
|
||||
Reference in New Issue
Block a user