更新
This commit is contained in:
@@ -201,4 +201,12 @@ public class AcsToWmsController {
|
||||
public ResponseEntity<Object> outKiln(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(acsToWmsService.outKiln(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/mark")
|
||||
@Log("打印唛头")
|
||||
@ApiOperation("打印唛头")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> mark(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(acsToWmsService.mark(whereJson), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,4 +115,7 @@ public interface AcsToWmsService {
|
||||
JSONObject getVehicleInfo(JSONObject whereJson);
|
||||
|
||||
JSONObject outKiln(JSONObject whereJson);
|
||||
|
||||
|
||||
JSONObject mark(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,5 @@ public interface WmsToAcsService {
|
||||
|
||||
JSONObject light(JSONArray whereJson);
|
||||
|
||||
/**
|
||||
* 获取点位
|
||||
*/
|
||||
JSONObject writeVehicle(JSONArray whereJson);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@@ -249,9 +251,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
if (StrUtil.isBlank(weight)) {
|
||||
throw new BadRequestException("重量不能为空!");
|
||||
}
|
||||
workorder.put("real_qty", workorder.getIntValue("real_qty") + Integer.parseInt(weight));
|
||||
TaskUtils.addACSUpdateColum(workorder);
|
||||
WQLObject.getWQLObject("pdm_bd_workorder").update(workorder);
|
||||
|
||||
WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail");
|
||||
JSONObject vd_update = new JSONObject();
|
||||
@@ -706,7 +705,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
workorder.put("unqualified_qty", unqualified_qty);
|
||||
}
|
||||
if (!"0".equals(workorder.getString("unqualified_qty"))) {
|
||||
JSONObject regionIn = TaskUtils.buildRegionInFromWorkorder(workorder, RegionInType.FPRK);
|
||||
JSONObject regionIn = TaskUtils.buildRegionInFromWorkorder(workorder);
|
||||
WQLObject.getWQLObject("st_ivt_regionio").insert(regionIn);
|
||||
}
|
||||
String qualified_qty = jsonObject.getString("qualified_qty");
|
||||
@@ -948,4 +947,57 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
public JSONObject transApply(JSONObject param) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject mark(JSONObject whereJson) {
|
||||
int vehicle_type = whereJson.getIntValue("vehicle_type");
|
||||
if (vehicle_type == 0) {
|
||||
throw new BadRequestException("载具类型不能为空!");
|
||||
}
|
||||
vehicle_type = vehicle_type + 2;
|
||||
String vehicle_code = TaskUtils.formatVehicleCode(whereJson.getString("vehicle_code"));
|
||||
if ("0000".equals(vehicle_code)) {
|
||||
throw new BadRequestException("载具编码不能为空!");
|
||||
}
|
||||
|
||||
JSONObject info = WQL
|
||||
.getWO("ACS_TO_WMS")
|
||||
.addParam("flag", "3")
|
||||
.addParam("vehicle_type", vehicle_type)
|
||||
.addParam("vehicle_code", vehicle_code)
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(info)) {
|
||||
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("is_package", info.getString("is_package"));
|
||||
String material_code = info.getString("material_code");
|
||||
data.put("order_code", material_code.substring(11, 16));
|
||||
data.put("customer", material_code.substring(16, 21));
|
||||
data.put("product_name", info.getString("furnace") + info.getString("material_brick_type"));
|
||||
data.put("product_grade", info.getString("product_grade"));
|
||||
|
||||
double single_weight = info.getDoubleValue("single_weight");
|
||||
data.put("single_weight", String.valueOf(single_weight));
|
||||
int qty = info.getIntValue("qty");
|
||||
data.put("qty", String.valueOf(qty));
|
||||
int weight = info.getIntValue("weight");
|
||||
if (weight == 0) {
|
||||
weight = Math.toIntExact(Math.round(single_weight * qty));
|
||||
}
|
||||
data.put("weight", String.valueOf(weight));
|
||||
data.put("date", DateUtil.format(new Date(), "yyyyMMdd"));
|
||||
data.put("material_code", material_code.substring(0, 11));
|
||||
data.put("brick_type", info.getString("brick_type"));
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "信息已下发!");
|
||||
result.put("data", data);
|
||||
return result;
|
||||
} else {
|
||||
throw new BadRequestException("[" + VehicleType.get(String.valueOf(vehicle_type)).label() + "] [" + vehicle_code + "] 无信息!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,4 +72,10 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
return AcsUtil.notifyAcs(api, whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject writeVehicle(JSONArray whereJson) {
|
||||
String api = "api/wms/writeVehicle";
|
||||
return AcsUtil.notifyAcs(api, whereJson);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -73,3 +73,26 @@
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
QUERY
|
||||
SELECT
|
||||
vd.is_package,
|
||||
material.material_code,
|
||||
material.furnace,
|
||||
material.material_brick_type,
|
||||
material.product_grade,
|
||||
material.weight AS single_weight,
|
||||
vd.qty,
|
||||
vd.weight,
|
||||
material.brick_type
|
||||
FROM
|
||||
st_ivt_vehicle_detail vd
|
||||
LEFT JOIN md_me_materialbase material ON vd.material_id = material.material_id
|
||||
WHERE
|
||||
vd.is_delete = '0'
|
||||
AND vd.vehicle_type = 输入.vehicle_type
|
||||
AND vd.vehicle_code = 输入.vehicle_code
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
@@ -441,7 +441,7 @@ public class WorkorderServiceImpl implements WorkordeService {
|
||||
}
|
||||
|
||||
if (!"0".equals(workorder.getString("unqualified_qty"))) {
|
||||
JSONObject regionIn = TaskUtils.buildRegionInFromWorkorder(workorder, RegionInType.FPRK);
|
||||
JSONObject regionIn = TaskUtils.buildRegionInFromWorkorder(workorder);
|
||||
WQLObject.getWQLObject("st_ivt_regionio").insert(regionIn);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@ public enum RegionInType {
|
||||
|
||||
WGRK("完工入库", "F"),
|
||||
BCPRK("半成品入库", "W"),
|
||||
FPRK("废品入库", "W");
|
||||
BCPFPRK("半成品废品入库", "W"),
|
||||
CCPFPRK("产成品废品入库", "F");
|
||||
|
||||
private final String label;
|
||||
private final String value;
|
||||
|
||||
@@ -87,6 +87,7 @@ public class FJCallEmptyTask extends AbstractAcsTask {
|
||||
.addParam("flag", "6")
|
||||
.addParam("vehicle_type", task.getString("vehicle_type"))
|
||||
.addParam("material_id", task.getString("material_id"))
|
||||
.addParam("point_code", task.getString("point_code2"))
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(bthc_point)) {
|
||||
|
||||
@@ -155,6 +155,7 @@
|
||||
AND point.point_status = '1'
|
||||
AND point.vehicle_type = 输入.vehicle_type
|
||||
AND vd.material_id = 输入.material_id
|
||||
AND vd.point_code = 输入.point_code
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
@@ -308,13 +308,19 @@ public class FJSendMaterialTask extends AbstractAcsTask {
|
||||
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
|
||||
}
|
||||
|
||||
// todo 如果是送料任务需要发送唛头信息到包装机
|
||||
|
||||
if (TaskType.SEND_MATERIAL.value().equals(task.getString("task_type"))) {
|
||||
JSONObject point2 = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + point_code2 + "'").uniqueResult(0);
|
||||
if (Region.FJ.value().equals(point2.getString("region_code")) && "5".equals(point2.getString("point_type"))) {
|
||||
JSONObject regionIn = TaskUtils.buildRegionInFromTask(task, RegionInType.WGRK);
|
||||
WQLObject.getWQLObject("st_ivt_regionio").insert(regionIn);
|
||||
|
||||
JSONArray param = new JSONArray();
|
||||
JSONObject info = new JSONObject();
|
||||
info.put("device_code", point_code2);
|
||||
info.put("vehicle_type", task.getIntValue("vehicle_type") - 2);
|
||||
info.put("vehicle_code", task.getString("vehicle_code"));
|
||||
param.add(info);
|
||||
wmsToAcsService.writeVehicle(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,6 +255,18 @@ public class HLSendMaterialTask extends AbstractAcsTask {
|
||||
}
|
||||
point_table.update(point2, "point_code = '" + point_code2 + "'");
|
||||
}
|
||||
|
||||
JSONObject workorder = WQL
|
||||
.getWO("SEND_MATERIAL_TASK")
|
||||
.addParam("flag", "7")
|
||||
.addParam("vd_id", task.getLongValue("group_id"))
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
|
||||
JSONObject workorder_update = new JSONObject();
|
||||
workorder_update.put("real_qty", workorder.getIntValue("real_qty") + workorder.getIntValue("weight"));
|
||||
TaskUtils.addACSUpdateColum(workorder_update);
|
||||
WQLObject.getWQLObject("pdm_bd_workorder").update(workorder_update, "workorder_id = " + workorder.getString("workorder_id"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,3 +151,18 @@
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "7"
|
||||
QUERY
|
||||
SELECT
|
||||
vd.weight,
|
||||
workorder.workorder_id
|
||||
workorder.real_qty
|
||||
FROM
|
||||
st_ivt_vehicle_detail vd
|
||||
LEFT JOIN pdm_bd_workorder workorder ON vd.workorder_id = workorder.workorder_id
|
||||
WHERE
|
||||
vd.vd_id = 输入.vd_id
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.basedata.eum.TrueOrFalse;
|
||||
import org.nl.wms.common.PickType;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.sch.manage.*;
|
||||
import org.nl.wms.sch.task.util.TaskUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -22,6 +23,8 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
public class BTHCToPackageTask extends AbstractAcsTask {
|
||||
|
||||
private final WmsToAcsService wmsToAcsService;
|
||||
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject task, String status) {
|
||||
if (TaskStatus.EXECUTING.value().equals(status)) {
|
||||
@@ -227,6 +230,14 @@ public class BTHCToPackageTask extends AbstractAcsTask {
|
||||
|
||||
JSONObject regionIn = TaskUtils.buildRegionInFromTask(task, RegionInType.WGRK);
|
||||
WQLObject.getWQLObject("st_ivt_regionio").insert(regionIn);
|
||||
|
||||
JSONArray param = new JSONArray();
|
||||
JSONObject info = new JSONObject();
|
||||
info.put("device_code", point_code2);
|
||||
info.put("vehicle_type", task.getIntValue("vehicle_type") - 2);
|
||||
info.put("vehicle_code", task.getString("vehicle_code"));
|
||||
param.add(info);
|
||||
wmsToAcsService.writeVehicle(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.basedata.eum.TrueOrFalse;
|
||||
import org.nl.wms.common.PickType;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.sch.manage.*;
|
||||
import org.nl.wms.sch.task.util.TaskUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -22,6 +23,8 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
public class FJToPackageTask extends AbstractAcsTask {
|
||||
|
||||
private final WmsToAcsService wmsToAcsService;
|
||||
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject task, String status) {
|
||||
if (TaskStatus.EXECUTING.value().equals(status)) {
|
||||
@@ -229,6 +232,14 @@ public class FJToPackageTask extends AbstractAcsTask {
|
||||
|
||||
JSONObject regionIn = TaskUtils.buildRegionInFromTask(task, RegionInType.WGRK);
|
||||
WQLObject.getWQLObject("st_ivt_regionio").insert(regionIn);
|
||||
|
||||
JSONArray param = new JSONArray();
|
||||
JSONObject info = new JSONObject();
|
||||
info.put("device_code", point_code2);
|
||||
info.put("vehicle_type", task.getIntValue("vehicle_type") - 2);
|
||||
info.put("vehicle_code", task.getString("vehicle_code"));
|
||||
param.add(info);
|
||||
wmsToAcsService.writeVehicle(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,36 +174,46 @@ public class TaskUtils {
|
||||
JSONObject regionIn = new JSONObject();
|
||||
regionIn.put("id", IdUtil.getSnowflake(1L, 1L).nextId());
|
||||
regionIn.put("cCode", CodeUtil.getNewCode("IN_STORE_CODE"));
|
||||
regionIn.put("dDate", DateUtil.today());
|
||||
regionIn.put("dDate", DateUtil.now());
|
||||
regionIn.put("cVouchType", regionInType.label());
|
||||
String material_code = detail.getString("material_code");
|
||||
String cMocode = material_code.substring(11, 16);
|
||||
regionIn.put("cMocode", cMocode);
|
||||
String order_code = detail.getString("order_code");
|
||||
regionIn.put("cMocode", order_code);
|
||||
regionIn.put("cInvCode", regionInType.value() + material_code);
|
||||
regionIn.put("iQuantity", String.format("%.3f", detail.getDoubleValue("vd_weight") / 1000));
|
||||
regionIn.put("iNum", detail.getString("qty"));
|
||||
regionIn.put("iinvexchrate", String.format("%.5f", detail.getDoubleValue("material_weight") / 1000));
|
||||
regionIn.put("cBatch", cMocode);
|
||||
double vd_weight = detail.getDoubleValue("vd_weight");
|
||||
int qty = detail.getIntValue("qty");
|
||||
double material_weight = detail.getDoubleValue("material_weight");
|
||||
if (vd_weight == 0) {
|
||||
vd_weight = qty * material_weight;
|
||||
}
|
||||
regionIn.put("iQuantity", String.format("%.3f", vd_weight / 1000));
|
||||
regionIn.put("iNum", qty);
|
||||
regionIn.put("iinvexchrate", String.format("%.5f", material_weight / 1000));
|
||||
regionIn.put("cBatch", order_code);
|
||||
return regionIn;
|
||||
}
|
||||
|
||||
public static JSONObject buildRegionInFromWorkorder(JSONObject workorder, RegionInType regionInType) {
|
||||
public static JSONObject buildRegionInFromWorkorder(JSONObject workorder) {
|
||||
JSONObject detail = WQL.getWO("TASK_UTILS").addParam("flag", "2").addParam("workorder_id", workorder.getString("workorder_id")).process().uniqueResult(0);
|
||||
RegionInType regionInType = RegionInType.BCPFPRK;
|
||||
if (Region.FJ.value().equals(detail.getString("region_code"))) {
|
||||
regionInType = RegionInType.CCPFPRK;
|
||||
}
|
||||
JSONObject regionIn = new JSONObject();
|
||||
regionIn.put("id", IdUtil.getSnowflake(1L, 1L).nextId());
|
||||
regionIn.put("cCode", CodeUtil.getNewCode("IN_STORE_CODE"));
|
||||
regionIn.put("dDate", DateUtil.now());
|
||||
regionIn.put("cVouchType", regionInType.label());
|
||||
String material_code = detail.getString("material_code");
|
||||
String cMocode = material_code.substring(11, 16);
|
||||
regionIn.put("cMocode", cMocode);
|
||||
String order_code = detail.getString("order_code");
|
||||
regionIn.put("cMocode", order_code);
|
||||
regionIn.put("cInvCode", regionInType.value() + material_code);
|
||||
int qty = workorder.getIntValue("unqualified_qty");
|
||||
regionIn.put("iNum", qty);
|
||||
double material_weight = detail.getDoubleValue("material_weight");
|
||||
regionIn.put("iinvexchrate", String.format("%.5f", material_weight / 1000));
|
||||
regionIn.put("iQuantity", String.format("%.3f", qty * material_weight / 1000));
|
||||
regionIn.put("cBatch", cMocode);
|
||||
regionIn.put("cBatch", order_code);
|
||||
return regionIn;
|
||||
}
|
||||
|
||||
@@ -214,13 +224,13 @@ public class TaskUtils {
|
||||
regionIn.put("cCode", CodeUtil.getNewCode("IN_STORE_CODE"));
|
||||
regionIn.put("dDate", DateUtil.now());
|
||||
String material_code = detail.getString("material_code");
|
||||
String cMocode = material_code.substring(11, 16);
|
||||
regionIn.put("cMocode", cMocode);
|
||||
String order_code = detail.getString("order_code");
|
||||
regionIn.put("cMocode", order_code);
|
||||
regionIn.put("cInvCode", regionOutType.value() + material_code);
|
||||
regionIn.put("iQuantity", String.format("%.3f", detail.getDoubleValue("vd_weight") / 1000));
|
||||
regionIn.put("iNum", detail.getString("qty"));
|
||||
regionIn.put("iinvexchrate", String.format("%.5f", detail.getDoubleValue("material_weight") / 1000));
|
||||
regionIn.put("cBatch", cMocode);
|
||||
regionIn.put("cBatch", order_code);
|
||||
return regionIn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,8 @@
|
||||
vd.qty,
|
||||
vd.weight AS vd_weight,
|
||||
material.weight AS material_weight,
|
||||
material.material_code
|
||||
material.material_code,
|
||||
material.order_code
|
||||
FROM
|
||||
st_ivt_vehicle_detail vd
|
||||
LEFT JOIN md_me_materialbase material ON vd.material_id = material.material_id
|
||||
@@ -60,9 +61,12 @@
|
||||
SELECT
|
||||
workorder.unqualified_qty AS qty,
|
||||
material.material_code AS material_code,
|
||||
material.weight AS material_weight
|
||||
material.weight AS material_weight,
|
||||
material.order_code,
|
||||
device.region_code
|
||||
FROM
|
||||
pdm_bd_workorder workorder
|
||||
LEFT JOIN pdm_bi_device device ON workorder.device_id = device.device_id
|
||||
LEFT JOIN md_me_materialbase material ON workorder.material_id = material.material_id
|
||||
WHERE
|
||||
workorder.workorder_id = 输入.workorder_id
|
||||
|
||||
Reference in New Issue
Block a user