This commit is contained in:
2022-11-29 15:36:14 +08:00
parent 6db99268b6
commit b5c6134eba
9 changed files with 223 additions and 20 deletions

View File

@@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
@@ -88,12 +89,12 @@ public class ProductInstorServiceImpl implements ProductInstorService {
HashMap<String, String> map = new HashMap<>();
map.put("box_no", box_no);
if (option.equals("3")) {
/*if (option.equals("3")) {
HashMap<String, String> sub_map = new HashMap<>();
sub_map.put("box_type", material_code);
//如果是退货入库要更新子卷包装关系的木箱料号
WQLObject.getWQLObject("pdm_bi_subpackagerelation").update(sub_map, "package_box_SN = '" + box_no + "'");
}
}*/
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
@@ -134,6 +135,14 @@ public class ProductInstorServiceImpl implements ProductInstorService {
//判断是否虚拟
if (!is_virtual.equals("1")) {
//判断是该包装计划是否存在长宽高
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_SN = '" + box_no + "'").uniqueResult(0);
String box_length = sub_jo.getString("box_length");
String box_width = sub_jo.getString("box_width");
String box_high = sub_jo.getString("box_high");
if (StrUtil.isEmpty(box_length) || StrUtil.isEmpty(box_width) || StrUtil.isEmpty(box_high)){
throw new BadRequestException("该木箱没有长宽高信息,无法入库,请到子卷包装关系中维护!");
}
//创建二楼去一楼的任务
} else {
String task_id = IdUtil.getSnowflake(1, 1).nextId() + "";

View File

@@ -1,5 +1,6 @@
package org.nl.wms.st.instor.rest;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -35,6 +36,7 @@ public class HandMoveStorController {
public ResponseEntity<Object> getOutBillDtl(@RequestParam Map whereJson){
return new ResponseEntity<>(handMoveStorService.getOutBillDtl(whereJson), HttpStatus.OK);
}
@Log("删除移库单")
@ApiOperation("删除移库单")
@DeleteMapping
@@ -50,6 +52,7 @@ public class HandMoveStorController {
handMoveStorService.update(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping()
@Log("新增移库单")
@ApiOperation("新增移库单")
@@ -57,12 +60,21 @@ public class HandMoveStorController {
handMoveStorService.insertDtl(whereJson);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@GetMapping("/getStructIvt")
@Log("查询可分配库存")
@ApiOperation("查询可分配库存")
public ResponseEntity<Object> getStructIvt(@RequestParam Map whereJson, Pageable page){
return new ResponseEntity<>(handMoveStorService.getStructIvt(whereJson,page), HttpStatus.OK);
}
@PostMapping("/getBoxIvt")
@Log("查询箱内库存")
@ApiOperation("查询箱内库存")
public ResponseEntity<Object> getBoxIvt(@RequestBody JSONArray whereJson){
return new ResponseEntity<>(handMoveStorService.getBoxIvt(whereJson), HttpStatus.OK);
}
@PostMapping("/confirm")
@Log("移库单强制确认")
@ApiOperation("移库单强制确认")
@@ -70,12 +82,14 @@ public class HandMoveStorController {
handMoveStorService.confirm(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@GetMapping("/getInvTypes")
@Log("查询单据字段")
@ApiOperation("查询单据字段")
public ResponseEntity<Object> getInvTypes(){
return new ResponseEntity<>(handMoveStorService.getInvTypes(), HttpStatus.OK);
}
@PostMapping("/handdown")
@Log("移库单手动下发")
@ApiOperation("移库单手动下发")

View File

@@ -53,6 +53,8 @@ public interface HandMoveStorService {
* @return
*/
Map<String, Object> getStructIvt(Map whereJson, Pageable page);
JSONArray getBoxIvt(JSONArray whereJson);
/**
* 出库单强制确认
* @param whereJson /

View File

@@ -27,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
/**
@@ -136,7 +137,7 @@ public class HandMoveStorServiceImpl implements HandMoveStorService {
String moveinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
String bill_code = CodeUtil.getNewCode("MOVE_CODE");
String biz_date = (String) map.get("biz_date");
biz_date = biz_date.substring(0,10);
biz_date = biz_date.substring(0, 10);
map.put("moveinv_id", moveinv_id);
map.put("bill_code", bill_code);
map.put("buss_type", "");
@@ -189,7 +190,7 @@ public class HandMoveStorServiceImpl implements HandMoveStorService {
HashMap<String, String> row = rows.get(i);
JSONObject jo_row = (JSONObject) JSONObject.toJSON(row);
String storagevehicle_code = row.get("storagevehicle_code");
if (i == 0){
if (i == 0) {
ids.append("'");
}
if (!Struct_map.containsKey(storagevehicle_code)) {
@@ -306,7 +307,7 @@ public class HandMoveStorServiceImpl implements HandMoveStorService {
public String insertDtl2(JSONObject json) {
//主表
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_MoveInv");
JSONArray rows =json.getJSONArray("tableData");
JSONArray rows = json.getJSONArray("tableData");
json.remove("tableData");
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
@@ -365,7 +366,7 @@ public class HandMoveStorServiceImpl implements HandMoveStorService {
Struct_map.put(storagevehicle_code, row);
}
if (i != 0) {
ids. append("','");
ids.append("','");
}
ids.append(storagevehicle_code);
}
@@ -534,7 +535,7 @@ public class HandMoveStorServiceImpl implements HandMoveStorService {
.addParam("is_issued", "0")
.process()
.getResultJSONArray(0);
if(ObjectUtil.isEmpty(diss)) {
if (ObjectUtil.isEmpty(diss)) {
throw new BadRequestException("不存在可以取消的出库分配明细");
}
for (int i = 0; i < diss.size(); i++) {
@@ -634,6 +635,28 @@ public class HandMoveStorServiceImpl implements HandMoveStorService {
return jo;
}
@Override
public JSONArray getBoxIvt(JSONArray whereJson) {
JSONArray total_rows = new JSONArray();
HashSet<String> set = new HashSet<>();
for (int i = 0; i < whereJson.size(); i++) {
JSONObject row = whereJson.getJSONObject(i);
String storagevehicle_code = row.getString("storagevehicle_code");
set.add(storagevehicle_code);
}
for (String s : set) {
JSONArray rows = WQL.getWO("QST_IVT_HANDMOVESTOR")
.addParam("flag", "5")
.addParam("storagevehicle_code", s).process().getResultJSONArray(0);
for (int i = 0; i < rows.size(); i++) {
JSONObject mater = rows.getJSONObject(i);
total_rows.add(mater);
}
}
return total_rows;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void confirm(JSONObject form) {

View File

@@ -36,6 +36,7 @@
输入.is_issued TYPEAS s_string
输入.remark TYPEAS s_string
输入.task_id TYPEAS s_string
输入.storagevehicle_code TYPEAS s_string
输入.struct_code TYPEAS s_string
输入.ids TYPEAS f_string
输入.deptIds TYPEAS f_string
@@ -272,5 +273,44 @@
ENDQUERY
ENDIF
IF 输入.flag = "5"
QUERY
SELECT
ivt2.stockrecord_id,
ivt2.material_id,
ivt2.pcsn,
ivt2.quality_scode,
ivt2.qty_unit_id,
ivt2.ivt_qty AS qty,
mb.material_code,
mb.material_name,
struct.struct_id AS turnout_struct_id,
struct.struct_code AS turnout_struct_code,
struct.struct_name AS turnout_struct_name,
struct.sect_id AS turnout_sect_id,
struct.sect_name AS turnout_sect_name,
struct.sect_code AS turnout_sect_code,
struct.storagevehicle_id,
struct.storagevehicle_code,
mu.unit_name AS qty_unit_name,
sub.sale_order_name,
sub.customer_name,
sub.customer_description
FROM
st_ivt_structattr struct
INNER JOIN ST_IVT_StructIvt ivt2 ON struct.struct_id = ivt2.struct_id
LEFT JOIN md_me_materialbase mb ON mb.material_id = ivt2.material_id
LEFT JOIN md_pb_measureunit mu ON mu.measure_unit_id = ivt2.qty_unit_id
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.container_name = ivt2.pcsn
WHERE
1 = 1
AND struct.lock_type = '1'
OPTION 输入.storagevehicle_code <> ""
struct.storagevehicle_code = 输入.storagevehicle_code
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -130,7 +130,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
JSONObject jsonSect = sectTab.query("sect_id = '" + json2.getString("sect_id") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonSect)) {
//jsonDtl.put("LGORT", jsonSect.getString("ext_id")); // 明細储存地点
jsonDtl.put("LGORT", json.getString("remark")); // 明細储存地点
jsonDtl.put("LGORT", jo_mst.getString("remark")); // 明細储存地点
}
JSONObject jsonSub = subTab.query("container_name = '" + json2.getString("pcsn") + "'").uniqueResult(0);
@@ -260,7 +260,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
JSONObject jsonSect = sectTab.query("sect_id = '" + json2.getString("sect_id") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonSect)) {
//jsonDtl.put("LGORT", jsonSect.getString("ext_id")); // 明細储存地点
jsonDtl.put("LGORT", json.getString("remark")); // 明細储存地点
jsonDtl.put("LGORT", jo_mst.getString("remark")); // 明細储存地点
}
JSONObject jsonSub = subTab.query("container_name = '" + json2.getString("pcsn") + "'").uniqueResult(0);
@@ -289,6 +289,97 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
new LmsToSapServiceImpl().returnDelivery(param);
}
// 销售出库
if (StrUtil.equals(bill_type, "1001")) {
// 1.回传sap
JSONArray paramSapMstArr = new JSONArray();
JSONObject paramSapMst = new JSONObject();
paramSapMst.put("ZACTION", "P");
paramSapMst.put("BUDAT", jo_mst.getString("biz_date"));
paramSapMst.put("ZZYGYF", jo_mst.getString("estimated_freight"));
paramSapMst.put("ZZYFGY", jo_mst.getString("trans_code"));
JSONArray paramDtlArr = new JSONArray();
JSONArray dtlArr = wo_dtl.query("iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").getResultJSONArray(0);
for (int k = 0; k < dtlArr.size(); k++) {
JSONArray paramDisArr = new JSONArray();
JSONObject json = dtlArr.getJSONObject(k);
JSONObject jsonMater = materTab.query("material_id = '" + json.getString("material_id") + "'").uniqueResult(0);
// 明细
JSONObject jsonDtl = new JSONObject();
jsonDtl.put("VBELN", json.getString("vbeln")); // 交货
paramSapMst.put("VBELN", json.getString("vbeln")); // 主表交货
jsonDtl.put("POSNR", json.getString("posnr")); // 项目
jsonDtl.put("MATNR", jsonMater.getString("material_code"));
// 分配明细
JSONArray disArr = wo_dis.query("iostorinvdtl_id = '" + json.getString("iostorinvdtl_id") + "'").getResultJSONArray(0);
for (int j = 0; j < disArr.size(); j++) {
JSONObject json2 = disArr.getJSONObject(j);
JSONObject jsonDis = new JSONObject();
JSONObject jsonSect = sectTab.query("sect_id = '" + json2.getString("sect_id") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonSect)) {
//jsonDtl.put("LGORT", jsonSect.getString("ext_id")); // 明細储存地点
jsonDtl.put("LGORT", jo_mst.getString("remark")); // 明細储存地点
}
JSONObject jsonSub = subTab.query("container_name = '" + json2.getString("pcsn") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonSect)) {
jsonDis.put("CHARG", jsonSub.getString("sap_pcsn")); // sap批次
}
jsonDis.put("VBELN", json.getString("vbeln")); // 交货
jsonDis.put("POSNR", json.getString("posnr")); // 项目
jsonDis.put("LFIMG", json2.getString("real_qty"));
jsonDis.put("VRKME", json.getString("qty_unit_name"));
jsonDis.put("PIKMG", json2.getString("real_qty"));
jsonDis.put("VRKMP", json2.getString("qty_unit_name"));
paramDisArr.add(jsonDis);
}
jsonDtl.put("CHARG_T", paramDisArr);
paramDtlArr.add(jsonDtl);
}
paramSapMst.put("ITEM", paramDtlArr);
paramSapMstArr.add(paramSapMst);
JSONObject param = new JSONObject();
param.put("HEAD", paramSapMstArr);
System.out.println(param.toString());
// 调用接口回传
new LmsToSapServiceImpl().returnDelivery(param);
// 2.回传mes
JSONObject paramMesMst = new JSONObject();
String userName = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
String passWord = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
paramMesMst.put("UserName", userName);
paramMesMst.put("Password", passWord);
paramMesMst.put("iOutboundOrderNum", jo_mst.getString("bill_code"));
paramMesMst.put("iOutboundUser", jo_mst.getString("confirm_optname"));
paramMesMst.put("iOutboundTime", jo_mst.getString("confirm_time"));
JSONArray boxArr = WQL.getWO("ST_OUTIVT02").addParam("flag", "2")
.addParam("iostorinv_id", jo_mst.getString("iostorinv_id"))
.process().getResultJSONArray(0);
JSONArray paramArr = new JSONArray();
for (int j = 0; j < boxArr.size(); j++) {
JSONObject json = boxArr.getJSONObject(j);
JSONObject jsonBox = new JSONObject();
jsonBox.put("PackageBoxSN", json.getString("box_no"));
paramArr.add(jsonBox);
}
paramMesMst.put("item", paramArr);
// 调用接口回传
// JSONObject jsonObject = new LmsToMesServiceImpl().childRollFGOutboundComplete(paramMesMst);
}
// 改切出库
if (StrUtil.equals(bill_type, "1003")) {
JSONObject paramMst = new JSONObject();
@@ -319,7 +410,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
JSONObject jsonSect = sectTab.query("sect_id = '" + json.getString("sect_id") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonSect)) {
//jsonDtl.put("LGORT", jsonSect.getString("ext_id")); // 库存地点:库区外部标识
jsonDtl.put("LGORT", json.getString("remark")); // 库存地点:库区外部标识
jsonDtl.put("LGORT", jo_mst.getString("remark")); // 库存地点:库区外部标识
}
JSONObject jsonSub = subTab.query("container_name = '" + json.getString("pcsn") + "'").uniqueResult(0);
@@ -446,7 +537,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
JSONObject jsonSect = sectTab.query("sect_id = '" + json2.getString("sect_id") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonSect)) {
// jsonDtl.put("LGORT", jsonSect.getString("ext_id")); // 明細储存地点
jsonDtl.put("LGORT", json.getString("remark")); // 明細储存地点
jsonDtl.put("LGORT", jo_mst.getString("remark")); // 明細储存地点
}
JSONObject jsonSub = subTab.query("container_name = '" + json2.getString("pcsn") + "'").uniqueResult(0);
@@ -536,7 +627,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
JSONObject jsonSect = sectTab.query("sect_id = '" + json2.getString("sect_id") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonSect)) {
//jsonDtl.put("LGORT", jsonSect.getString("ext_id")); // 明細储存地点
jsonDtl.put("LGORT", json.getString("remark")); // 明細储存地点
jsonDtl.put("LGORT", jo_mst.getString("remark")); // 明細储存地点
}
JSONObject jsonSub = subTab.query("container_name = '" + json2.getString("pcsn") + "'").uniqueResult(0);
@@ -614,7 +705,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
jsonDtl.put("BWART", "311");
jsonDtl.put("MENGE", json.getDoubleValue("plan_qty"));
jsonDtl.put("MEINS", json.getString("qty_unit_id"));
jsonDtl.put("LGORT", json.getString("remark")); // 库存地点
jsonDtl.put("LGORT", jo_mst.getString("remark")); // 库存地点
jsonDtl.put("CHARG", json.getString("pcsn"));
jsonDtl.put("UMLGO", ""); // 收货库存地点
jsonDtl.put("UMCHA", json.getString("pcsn"));

View File

@@ -446,10 +446,21 @@ export default {
}
},
deleteRow(index, rows) {
rows.splice(index, 1)
this.nowindex = ''
this.nowrow = {}
this.form.detail_count = this.form.tableData.length
const storagevehicle_code = rows[index].storagevehicle_code
let len = rows.length
while (len--) {
const obj = rows[len]
if (storagevehicle_code === obj.storagevehicle_code) {
const index = rows.indexOf(obj)
if (index > -1) { // 移除找到的指定元素
this.form.total_qty = parseFloat(this.form.total_qty) - parseFloat(rows[index].qty)
rows.splice(index, 1)
this.nowindex = ''
this.nowrow = {}
this.form.detail_count = this.form.tableData.length
}
}
}
},
[CRUD.HOOK.beforeSubmit]() {
if (this.form.tableData.length === 0) {

View File

@@ -93,6 +93,7 @@ import CRUD, { header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
import crudSectattr from '@/views/wms/basedata/st/sect/sectattr'
import handmovestor from '@/views/wms/st/inStor/moveStor/handmovestor'
export default {
name: 'AddDtl',
@@ -179,14 +180,18 @@ export default {
}
},
submit() {
debugger
this.rows = this.$refs.table.selection
if (this.rows.length <= 0) {
this.$message('请先勾选物料')
return
}
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
this.$emit('tableChanged', this.rows)
handmovestor.getBoxIvt(this.rows).then(res => {
this.rows = res
this.$emit('update:dialogShow', false)
this.$emit('tableChanged', this.rows)
})
}
}
}

View File

@@ -65,4 +65,12 @@ export function handdown(data) {
data
})
}
export default { add, edit, del, getOutBillDtl,getStructIvt,confirm,getInvTypes,handdown }
export function getBoxIvt(data) {
return request({
url: '/api/handmovestor/getBoxIvt',
method: 'post',
data
})
}
export default { add, edit, del, getOutBillDtl,getStructIvt,confirm,getInvTypes,handdown, getBoxIvt }