add:1.新增粉料移库,2.含水量修改
This commit is contained in:
@@ -848,7 +848,7 @@ public class PdmWorkTaskServiceImpl implements PdmWorkTaskService {
|
||||
String material_id = work_task.getString("material_id");
|
||||
String workprocedure_id = work_task.getString("workprocedure_id");
|
||||
|
||||
JSONArray work_para = WQLObject.getWQLObject("PDM_BI_WorkProcedureParaProduct").query("material_id = '" + material_id + "' AND workprocedure_id = '" + workprocedure_id + "'").getResultJSONArray(0);
|
||||
JSONArray work_para = WQLObject.getWQLObject("PDM_BI_WorkProcedureParaProduct").query("material_id = '" + material_id + "' AND workprocedure_id = '" + workprocedure_id + "' AND para_code <> 'QM002'").getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(work_para)) {
|
||||
throw new PdaRequestException("该产品未设置球磨参数!");
|
||||
}
|
||||
@@ -872,6 +872,13 @@ public class PdmWorkTaskServiceImpl implements PdmWorkTaskService {
|
||||
}
|
||||
data2.put("code", para.getString("ext_name"));
|
||||
data2.put("value", row.getString("value"));
|
||||
if (para.getString("ext_name").equals("to_alcohol1")) {
|
||||
JSONObject json = WQLObject.getWQLObject("PDM_BI_WorkProcedureParaProduct")
|
||||
.query("material_id = '" + material_id + "' AND workprocedure_id = '" + workprocedure_id + "' AND para_code = 'QM002'")
|
||||
.uniqueResult(0);
|
||||
|
||||
data2.put("value", json.getString("value"));
|
||||
}
|
||||
//预磨1酒精设定值:开单重量*工艺参数"预磨1酒精设定值(改为比例)"
|
||||
// double masterbucket_qty = form_jo.getDoubleValue("masterbucket_qty");
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package org.nl.pda.st.instor.rest;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.annotation.Log;
|
||||
import org.nl.pda.st.instor.service.MaterialMoveService;
|
||||
import org.nl.wql.core.content.HttpContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "手持入库移库")
|
||||
@RequestMapping("api/pda/st/move")
|
||||
@Slf4j
|
||||
public class MaterialMoveController {
|
||||
|
||||
@Autowired
|
||||
private MaterialMoveService materialMoveService;
|
||||
|
||||
@PostMapping("/queryMaterialList")
|
||||
@Log("查询可用库存")
|
||||
@ApiOperation("查询可用库存")
|
||||
public ResponseEntity<Object> queryMaterial(@RequestBody Map whereJson) {
|
||||
HttpContext ctx = new HttpContext("11");
|
||||
ctx.setPage((String) (whereJson.get("page")));
|
||||
ctx.setRows((String) (whereJson.get("size")));
|
||||
return new ResponseEntity<>(materialMoveService.queryMaterial(whereJson, ctx), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/confirm")
|
||||
@Log("确认")
|
||||
@ApiOperation("确认")
|
||||
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(materialMoveService.confirm(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.nl.pda.st.instor.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wql.core.content.HttpContext;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface MaterialMoveService {
|
||||
|
||||
/**
|
||||
* 查询可用库存
|
||||
*
|
||||
* @param jsonObject 条件
|
||||
* @return Map
|
||||
*/
|
||||
Map<String, Object> queryMaterial(Map<String, String> jsonObject, HttpContext ctx);
|
||||
|
||||
/**
|
||||
* 确认
|
||||
* @param whereJson 条件
|
||||
* @return Map
|
||||
*/
|
||||
Map<String, Object> confirm(JSONObject whereJson);
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package org.nl.pda.st.instor.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.pda.exception.PdaRequestException;
|
||||
import org.nl.pda.st.instor.service.MaterialMoveService;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.st.core.task.InTask;
|
||||
import org.nl.wms.st.instor.service.HandMoveStorService;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.core.content.HttpContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class MaterialMoveServiceImpl implements MaterialMoveService {
|
||||
|
||||
@Autowired
|
||||
private HandMoveStorService handMoveStorService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryMaterial(Map<String, String> jsonObject, HttpContext ctx) {
|
||||
|
||||
HashMap<String, String> map = new HashMap<String, String>();
|
||||
map.put("flag","3");
|
||||
if (StrUtil.isNotEmpty(jsonObject.get("material_code"))) {
|
||||
map.put("remark", "%" + jsonObject.get("material_code") + "%");
|
||||
}
|
||||
|
||||
JSONObject jo = WQL.getWO("QST_IVT_HANDMOVESTOR").addParamMap(map).pageQuery(ctx, "ivt2.struct_id");
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "查询成功!");
|
||||
returnjo.put("rows", jo.getJSONArray("content"));
|
||||
returnjo.put("size", jo.getString("totalElements"));
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Map<String, Object> confirm(JSONObject whereJson) {
|
||||
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr");
|
||||
WQLObject taskTable = WQLObject.getWQLObject("sch_base_task");
|
||||
|
||||
// 1.查询仓位是否存在
|
||||
JSONObject jsonAttr = attrTab.query("struct_code = '" + whereJson.getString("point_code") + "' AND is_delete = '0'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonAttr)) {
|
||||
throw new BadRequestException("点位不存在或已删除!");
|
||||
}
|
||||
|
||||
// 2.组织主表数据
|
||||
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("bill_code", "");
|
||||
map.put("stor_id", "1473161852946092032");
|
||||
map.put("stor_code", "01");
|
||||
map.put("stor_name", "原材料库");
|
||||
map.put("bill_status", "10");
|
||||
map.put("total_qty", whereJson.getJSONArray("dtl").getJSONObject(0).getDoubleValue("qty"));
|
||||
map.put("detail_count", 1);
|
||||
map.put("bill_type", "29");
|
||||
map.put("remark", "");
|
||||
map.put("biz_date", DateUtil.today());
|
||||
map.put("create_mode", "");
|
||||
|
||||
// 3.组织明细数据
|
||||
ArrayList<LinkedHashMap> tableData = new ArrayList<>();
|
||||
JSONArray dtlArr = whereJson.getJSONArray("dtl");
|
||||
for (int i = 0; i < dtlArr.size(); i++) {
|
||||
JSONObject json = dtlArr.getJSONObject(i);
|
||||
LinkedHashMap<String, Object> dtlmap = new LinkedHashMap<>();
|
||||
|
||||
|
||||
dtlmap.put("turnout_sect_name", json.getString("turnout_sect_name"));
|
||||
dtlmap.put("turnout_struct_code", json.getString("turnout_struct_code"));
|
||||
dtlmap.put("storagevehicle_code", json.getString("storagevehicle_code"));
|
||||
dtlmap.put("material_code", json.getString("material_code"));
|
||||
dtlmap.put("material_name", json.getString("material_name"));
|
||||
dtlmap.put("pcsn", json.getString("pcsn"));
|
||||
dtlmap.put("quality_scode", json.getString("quality_scode"));
|
||||
dtlmap.put("ivt_level", json.getString("ivt_level"));
|
||||
dtlmap.put("is_active", json.getString("is_active"));
|
||||
dtlmap.put("qty", json.getString("qty"));
|
||||
dtlmap.put("qty_unit_name", json.getString("qty_unit_name"));
|
||||
dtlmap.put("stockrecord_id", json.getString("stockrecord_id"));
|
||||
dtlmap.put("material_id", json.getString("material_id"));
|
||||
dtlmap.put("qty_unit_id", json.getString("qty_unit_id"));
|
||||
dtlmap.put("turnout_struct_id", json.getString("turnout_struct_id"));
|
||||
dtlmap.put("turnout_struct_name", json.getString("turnout_struct_name"));
|
||||
dtlmap.put("turnout_sect_id", json.getString("turnout_sect_id"));
|
||||
dtlmap.put("turnout_sect_code", json.getString("turnout_sect_code"));
|
||||
dtlmap.put("storagevehicle_id", json.getString("storagevehicle_id"));
|
||||
dtlmap.put("turnin_struct_id", jsonAttr.getString("struct_id"));
|
||||
dtlmap.put("turnin_struct_code", jsonAttr.getString("struct_code"));
|
||||
dtlmap.put("turnin_struct_name", jsonAttr.getString("struct_name"));
|
||||
dtlmap.put("turnin_sect_id", jsonAttr.getString("sect_id"));
|
||||
dtlmap.put("turnin_sect_code", jsonAttr.getString("sect_code"));
|
||||
dtlmap.put("turnin_sect_name", jsonAttr.getString("sect_name"));
|
||||
tableData.add(dtlmap);
|
||||
}
|
||||
map.put("tableData",tableData);
|
||||
|
||||
// 4.调用移库单新增
|
||||
handMoveStorService.insertDtl(map);
|
||||
|
||||
// 5.调用下发按钮
|
||||
AbstractAcsTask intask = new InTask();
|
||||
//调用ACS接受任务接口
|
||||
JSONObject taskObj = taskTable.query("vehicle_code='" + dtlArr.getJSONObject(0).getString("storagevehicle_code")+ "' and task_status='01' and is_delete ='0'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new PdaRequestException("托盘为【'" + dtlArr.getJSONObject(0).getString("storagevehicle_code") + "'】指令未找到");
|
||||
}
|
||||
intask.notifyAcs(taskObj.getString("taskdtl_id"));
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
return returnjo;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user