opt: 1.入库管理查询组盘信息。2.出库管理编码
This commit is contained in:
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -26,4 +27,6 @@ public interface MdPbStoragevehicleextMapper extends BaseMapper<MdPbStoragevehic
|
||||
* @return IPage<JSONObject>
|
||||
*/
|
||||
IPage<JSONObject> getCanuseIvt(Page<JSONObject> page, @Param("param") Map whereJson);
|
||||
|
||||
BigDecimal queryCanuseSumByPcsn(@Param("pcsn") String pcsn);
|
||||
}
|
||||
|
||||
@@ -56,4 +56,14 @@
|
||||
ORDER BY ext.insert_time Desc
|
||||
</select>
|
||||
|
||||
<select id="queryCanuseSumByPcsn" resultType="java.math.BigDecimal">
|
||||
SELECT
|
||||
SUM(canuse_qty)
|
||||
FROM
|
||||
md_pb_storagevehicleext
|
||||
<where>
|
||||
pcsn = #{pcsn}
|
||||
</where>
|
||||
ORDER BY ext.insert_time Desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.nl.wms.basedata_manage.service.dao.BsrealStorattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.Sectattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.StructattrMapper;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.dao.IOStorInv;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -239,12 +240,20 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
.set(Structattr::getInv_id,jsonObject.getString("inv_id"))
|
||||
.set(Structattr::getInv_code,jsonObject.getString("inv_code"))
|
||||
.set(Structattr::getInv_type,jsonObject.getString("inv_type"))
|
||||
.set(Structattr::getLock_type,"01")
|
||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("入库锁"))
|
||||
.eq(Structattr::getStruct_code,jsonObject.getString("struct_code"))
|
||||
);
|
||||
break;
|
||||
case "1":
|
||||
|
||||
//完成任务,解锁仓位绑定载具号
|
||||
this.update(new LambdaUpdateWrapper<>(Structattr.class)
|
||||
.set(Structattr::getInv_id,jsonObject.getString("inv_id"))
|
||||
.set(Structattr::getInv_code,jsonObject.getString("inv_code"))
|
||||
.set(Structattr::getInv_type,jsonObject.getString("inv_type"))
|
||||
.set(Structattr::getStoragevehicle_code,jsonObject.getString("storagevehicle_code"))
|
||||
.set(Structattr::getLock_type,IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.eq(Structattr::getStruct_code,jsonObject.getString("struct_code"))
|
||||
);
|
||||
break;
|
||||
|
||||
case "2":
|
||||
@@ -253,7 +262,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
.set(Structattr::getInv_id,jsonObject.getString("inv_id"))
|
||||
.set(Structattr::getInv_code,jsonObject.getString("inv_code"))
|
||||
.set(Structattr::getInv_type,jsonObject.getString("inv_type"))
|
||||
.set(Structattr::getLock_type,"00")
|
||||
.set(Structattr::getLock_type,IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.eq(Structattr::getStruct_code,jsonObject.getString("struct_code"))
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package org.nl.wms.warehouse_management.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.warehouse_management.service.IOutBillService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2025/5/29
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/checkoutbill")
|
||||
@Slf4j
|
||||
public class OutBillController {
|
||||
|
||||
@Resource
|
||||
private IOutBillService iOutBillService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询出库单")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page, String[] stor_id, String[] bill_status, String[] bill_type) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(iOutBillService.pageQuery(whereJson, page, stor_id, bill_status, bill_type)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getCanuseIvt")
|
||||
@Log("获取可用库存物料")
|
||||
public ResponseEntity<Object> getCanuseIvt(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(iOutBillService.getCanuseIvt(whereJson,page)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping()
|
||||
@Log("新增出库单")
|
||||
public ResponseEntity<Object> insertDtl(@RequestBody JSONObject whereJson) {
|
||||
iOutBillService.insertDtl(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@GetMapping("/getOutBillDtl")
|
||||
@Log("查询明细")
|
||||
public ResponseEntity<Object> getOutBillDtl(@RequestParam Map whereJson) {
|
||||
return new ResponseEntity<>(iOutBillService.getOutBillDtl(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getOutBillDis")
|
||||
@Log("查询未出库单分配")
|
||||
public ResponseEntity<Object> getOutBillDis(@RequestParam Map whereJson) {
|
||||
return new ResponseEntity<>(iOutBillService.getOutBillDis(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/allDiv")
|
||||
@Log("出库单全部分配")
|
||||
public ResponseEntity<Object> allDiv(@RequestBody JSONObject whereJson) {
|
||||
iOutBillService.allDiv(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
}
|
||||
@@ -81,13 +81,6 @@ public class RawAssistIStorController {
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PostMapping("/allDivStruct")
|
||||
@Log("全部分配货位")
|
||||
public ResponseEntity<Object> allDivStruct(@RequestBody JSONObject whereJson) {
|
||||
iRawAssistIStorService.allDivStruct(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PostMapping("/unDivStruct")
|
||||
@Log("取消分配货位")
|
||||
public ResponseEntity<Object> unDivStruct(@RequestBody Map whereJson) {
|
||||
@@ -102,47 +95,6 @@ public class RawAssistIStorController {
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PostMapping("/queryTask")
|
||||
@Log("查询任务")
|
||||
public ResponseEntity<Object> queryTask(@RequestBody Map whereJson) {
|
||||
return new ResponseEntity<>(iRawAssistIStorService.queryTask(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/updateTask")
|
||||
@Log("变更任务")
|
||||
public ResponseEntity<Object> updateTask(@RequestBody Map whereJson) {
|
||||
iRawAssistIStorService.updateTask(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PostMapping("/delTask")
|
||||
@Log("删除任务")
|
||||
public ResponseEntity<Object> delTask(@RequestBody Map whereJson) {
|
||||
iRawAssistIStorService.delTask(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PostMapping("/reIssueTask")
|
||||
@Log("下发")
|
||||
public ResponseEntity<Object> reIssueTask(@RequestBody Map whereJson) {
|
||||
iRawAssistIStorService.reIssueTask(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PostMapping("/confirmTask")
|
||||
@Log("完成任务")
|
||||
public ResponseEntity<Object> confirmTask(@RequestBody Map whereJson) {
|
||||
iRawAssistIStorService.confirmTask(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PostMapping("/cancelTask")
|
||||
@Log("取消完成任务")
|
||||
public ResponseEntity<Object> cancelTask(@RequestBody Map whereJson) {
|
||||
iRawAssistIStorService.cancelTask(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PostMapping("/confirm")
|
||||
@Log("完成单据")
|
||||
public ResponseEntity<Object> confirm(@RequestBody Map whereJson) {
|
||||
@@ -150,17 +102,16 @@ public class RawAssistIStorController {
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PostMapping("/backConfirm")
|
||||
@Log("完成入库负单")
|
||||
public ResponseEntity<Object> backConfirm(@RequestBody Map whereJson) {
|
||||
iRawAssistIStorService.backConfirm(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PostMapping("/autoDis")
|
||||
@Log("自动分配")
|
||||
public ResponseEntity<Object> autoDis(@RequestBody JSONObject whereJson) {
|
||||
iRawAssistIStorService.autoDis(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PostMapping("/getInBillTaskDtl")
|
||||
@Log("入库详情作业明细查询")
|
||||
public ResponseEntity<Object> getInBillTaskDtl(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(iRawAssistIStorService.getInBillTaskDtl(whereJson), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,18 @@ public enum IOSEnum {
|
||||
// 更新库存类型
|
||||
UPDATE_IVT_TYPE(MapOf.of("入库", "1", "出库", "2")),
|
||||
|
||||
//单据出入库类型
|
||||
IO_TYPE(MapOf.of("入库","0", "出库", "1")),
|
||||
|
||||
//单据状态
|
||||
BILL_STATUS(MapOf.of("生成","10", "分配中", "20", "分配完", "30", "完成", "99")),
|
||||
|
||||
//入库分配明细状态
|
||||
INBILL_DIS_STATUS(MapOf.of("生成", "00", "执行中", "01", "完成", "99")),
|
||||
|
||||
//组盘记录状态
|
||||
GROUP_PLATE_STATUS(MapOf.of("组盘", "01", "入库", "02", "出库", "03")),
|
||||
|
||||
// 锁类型
|
||||
LOCK_TYPE(MapOf.of("未锁定", "0", "入库锁", "1", "出库锁", "2"
|
||||
, "移入锁", "3", "移出锁", "4"
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package org.nl.wms.warehouse_management.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.warehouse_management.service.dao.IOStorInv;
|
||||
import org.nl.wms.warehouse_management.service.dto.IOStorInvDisDto;
|
||||
import org.nl.wms.warehouse_management.service.dto.IOStorInvDtlDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2025/5/29
|
||||
*/
|
||||
public interface IOutBillService extends IService<IOStorInv> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
IPage<IOStorInv> pageQuery(Map whereJson, PageQuery page, String[] stor_id, String[] bill_status, String[] bill_type);
|
||||
|
||||
/**
|
||||
* 获取可用库存物料
|
||||
* @param whereJson : {
|
||||
* 分页参数:page,size
|
||||
* stor_id: 仓库id
|
||||
* sect_id: 库区id
|
||||
* struct_code: 货位编码
|
||||
* material_code: 物料编码
|
||||
* pcsn: 批次
|
||||
* }
|
||||
* @param page : 分页对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
IPage<JSONObject> getCanuseIvt(Map whereJson, PageQuery page);
|
||||
|
||||
/**
|
||||
* 新增出库单
|
||||
*
|
||||
* @param whereJson 参数举例:
|
||||
* {bill_code=, stor_id=1473161852946092032, stor_code=01, stor_name=原材料库, bill_status=10, total_qty=2, detail_count=1, bill_type=010201, remark=, biz_date=2022-01-08, create_mode=, tableData=[{material_id=1309, material_code=090301010001, bill_status=10, material_name=碳化钨粉 02, pcsn=, quality_scode=02, ivt_level=01, is_active=1, plan_qty=2, qty_unit_name=千克\公斤, qty_unit_id=1, remark=, edit=true}]}
|
||||
* /
|
||||
*/
|
||||
String insertDtl(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 查询出库单明细
|
||||
*
|
||||
* @param whereJson /
|
||||
* @return
|
||||
*/
|
||||
List<IOStorInvDtlDto> getOutBillDtl(Map whereJson);
|
||||
|
||||
/**
|
||||
* 查询未出库分配
|
||||
* @param whereJson
|
||||
* @return
|
||||
*/
|
||||
List<IOStorInvDisDto> getOutBillDis(Map whereJson);
|
||||
|
||||
/**
|
||||
* 全部分配,对同一出库单明细进行分配
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void allDiv(JSONObject whereJson);
|
||||
|
||||
}
|
||||
@@ -41,31 +41,15 @@ public interface IRawAssistIStorService extends IService<IOStorInv> {
|
||||
|
||||
void divStruct(Map whereJson);
|
||||
|
||||
void allDivStruct(JSONObject form);
|
||||
|
||||
void unDivStruct(Map whereJson);
|
||||
|
||||
void divPoint(Map whereJson);
|
||||
|
||||
void updateTask(Map whereJson);
|
||||
|
||||
void delTask(Map whereJson);
|
||||
|
||||
void reIssueTask(Map whereJson);
|
||||
|
||||
void confirmTask(Map whereJson);
|
||||
|
||||
void cancelTask(Map whereJson);
|
||||
|
||||
void confirm(Map whereJson);
|
||||
|
||||
void backConfirm(Map whereJson);
|
||||
|
||||
List<IOStorInvDisDto> getDisDtl(Map whereJson);
|
||||
|
||||
JSONArray queryTask(Map whereJson);
|
||||
|
||||
Structattr autoDis(JSONObject whereJson);
|
||||
|
||||
JSONObject autoDisMove(JSONObject whereJson);
|
||||
List<IOStorInvDisDto> getInBillTaskDtl(Map whereJson);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.nl.wms.warehouse_management.service.dao.IOStorInvDis;
|
||||
import org.nl.wms.warehouse_management.service.dto.IOStorInvDisDto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
@@ -16,4 +17,9 @@ import java.util.List;
|
||||
public interface IOStorInvDisMapper extends BaseMapper<IOStorInvDis> {
|
||||
|
||||
List<IOStorInvDisDto> queryInBillDisDtlByIosId(@Param("iostorinvdtl_id")String iostorinvdtl_id);
|
||||
|
||||
List<IOStorInvDisDto> getInBillTaskDtl(@Param("iostorinvdtl_id")String iostorinvdtl_id);
|
||||
|
||||
//查询未出库单分配
|
||||
List<IOStorInvDisDto> queryOutBillDisDtl(@Param("params") Map whereJson);
|
||||
}
|
||||
|
||||
@@ -18,4 +18,42 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getInBillTaskDtl" resultType="org.nl.wms.warehouse_management.service.dto.IOStorInvDisDto">
|
||||
SELECT
|
||||
dis.*,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
task.task_code
|
||||
FROM
|
||||
st_ivt_iostorinvdis dis
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = dis.material_id
|
||||
LEFT JOIN sch_base_task task ON task.task_id = dis.task_id
|
||||
where
|
||||
dis.iostorinvdtl_id = #{iostorinvdtl_id}
|
||||
</select>
|
||||
|
||||
<select id="queryOutBillDisDtl" resultType="org.nl.wms.warehouse_management.service.dto.IOStorInvDisDto">
|
||||
SELECT
|
||||
dis.*,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
task.task_code,
|
||||
ext.insert_time
|
||||
FROM
|
||||
st_ivt_iostorinvdis dis
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = dis.material_id
|
||||
LEFT JOIN sch_base_task task ON task.task_id = dis.task_id
|
||||
LEFT JOIN md_pb_storagevehicleext ext ON ext.storagevehicle_code = dis.storagevehicle_code
|
||||
where
|
||||
1=1
|
||||
<if test="params.iostorinvdtl_id != null">
|
||||
AND
|
||||
dis.iostorinvdtl_id = #{params.iostorinvdtl_id}
|
||||
</if>
|
||||
<if test="params.bill_status != null">
|
||||
AND
|
||||
dis.work_status <= #{params.bill_status}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -21,8 +21,10 @@ public interface IOStorInvMapper extends BaseMapper<IOStorInv> {
|
||||
|
||||
IPage<IOStorInv> queryAllByPage (IPage<IOStorInv> page,@Param("params") Map whereJson);
|
||||
|
||||
IPage<GroupPlateDto> getBillDtl (IPage<GroupPlateDto> page, @Param("params") Map whereJson);
|
||||
IPage<GroupPlateDto> getGroupPlate (IPage<GroupPlateDto> page, @Param("params") Map whereJson);
|
||||
|
||||
List<IOStorInvDtlDto> getIODtl (@Param("params") Map whereJson);
|
||||
|
||||
IPage<IOStorInv> queryOutBillPage (IPage<IOStorInv> page,@Param("params") Map whereJson);
|
||||
|
||||
}
|
||||
|
||||
@@ -47,8 +47,9 @@
|
||||
ORDER BY ios.iostorinv_id Desc
|
||||
</select>
|
||||
|
||||
<select id="getBillDtl" resultType="org.nl.wms.warehouse_management.service.dto.GroupPlateDto">
|
||||
SELECT gp.*, mtl.material_code, mtl.material_name , gp.qty as plan_qty FROM md_pb_groupplate gp
|
||||
<select id="getGroupPlate" resultType="org.nl.wms.warehouse_management.service.dto.GroupPlateDto">
|
||||
SELECT MAX(group_id),storagevehicle_code,gp.material_id,pcsn,MAX(gp.qty_unit_id) as qty_unit_id,MAX(gp.qty_unit_name) as qty_unit_name,SUM(qty) as qty,SUM(qty) as plan_qty,MAX(remark),MAX(`status`),mtl.material_code, mtl.material_name
|
||||
FROM md_pb_groupplate gp
|
||||
LEFT JOIN md_me_materialbase mtl ON gp.material_id = mtl.material_id
|
||||
<where>
|
||||
gp.status = '01'
|
||||
@@ -73,7 +74,7 @@
|
||||
gp.create_time <= #{params.end_time}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY gp.create_time Desc
|
||||
GROUP by storagevehicle_code,gp.material_id,pcsn
|
||||
</select>
|
||||
|
||||
<select id="getIODtl" resultType="org.nl.wms.warehouse_management.service.dto.IOStorInvDtlDto">
|
||||
@@ -90,7 +91,7 @@
|
||||
LEFT JOIN md_pb_groupplate gp ON gp.pcsn = dtl.pcsn
|
||||
where
|
||||
1=1
|
||||
<if test="params.bill_code != null">
|
||||
<if test="params.bill_code != null and params.bill_code != ''">
|
||||
AND
|
||||
mst.bill_code = #{params.bill_code}
|
||||
</if>
|
||||
@@ -100,21 +101,73 @@
|
||||
mst.iostorinv_id = #{params.iostorinv_id}
|
||||
</if>
|
||||
|
||||
<if test="params.bill_status != null and params.bill_status != ''">
|
||||
AND
|
||||
dtl.bill_status <= #{params.bill_status}
|
||||
</if>
|
||||
|
||||
<if test="params.unassign_flag != null and params.unassign_flag != ''">
|
||||
AND
|
||||
dtl.unassign_qty > 0
|
||||
</if>
|
||||
|
||||
<if test="params.iostorinvdtl_id != null and params.iostorinvdtl_id != ''">
|
||||
AND
|
||||
dtl.iostorinvdtl_id = #{params.iostorinvdtl_id}
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="queryInBillDisDtlByIosId" resultType="org.nl.wms.warehouse_management.service.dto.IOStorInvDisDto">
|
||||
SELECT
|
||||
dis.*,
|
||||
mb.material_code,
|
||||
mb.material_name
|
||||
FROM
|
||||
st_ivt_iostorinvdis dis
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = dis.material_id
|
||||
where
|
||||
(dis.task_id is null OR dis.task_id = '')
|
||||
<if test="iostorinv_id != null">
|
||||
AND
|
||||
dis.iostorinv_id = #{iostorinv_id}
|
||||
</if>
|
||||
<select id="queryOutBillPage" resultType="org.nl.wms.warehouse_management.service.dao.IOStorInv">
|
||||
SELECT DISTINCT ios.* FROM st_ivt_iostorinv ios
|
||||
LEFT JOIN st_ivt_iostorinvdtl dtl ON ios.iostorinv_id = dtl.iostorinv_id
|
||||
LEFT JOIN st_ivt_iostorinvdis dis ON dtl.iostorinvdtl_id = dis.iostorinvdtl_id
|
||||
<where>
|
||||
ios.is_delete = '0' AND ios.io_type = '1'
|
||||
<if test="params.bill_code != null">
|
||||
AND
|
||||
ios.bill_code LIKE #{params.bill_code}
|
||||
</if>
|
||||
|
||||
<if test="params.is_upload != null">
|
||||
AND
|
||||
ios.is_upload = #{params.is_upload}
|
||||
</if>
|
||||
|
||||
<if test="params.storIds != null">
|
||||
AND
|
||||
ios.stor_id IN #{params.storIds}
|
||||
</if>
|
||||
|
||||
<if test="params.billStatuses != null">
|
||||
AND
|
||||
ios.bill_status IN #{params.billStatuses}
|
||||
</if>
|
||||
|
||||
<if test="params.billTypes != null">
|
||||
AND
|
||||
ios.bill_type IN #{params.billTypes}
|
||||
</if>
|
||||
|
||||
<if test="params.pcsn != null">
|
||||
AND
|
||||
dis.pcsn LIKE #{params.pcsn}
|
||||
</if>
|
||||
|
||||
<if test="params.pcsn_in != null">
|
||||
AND
|
||||
dis.pcsn IN #{params.pcsn_in}
|
||||
</if>
|
||||
|
||||
<if test="params.begin_time != null">
|
||||
AND
|
||||
ios.input_time >= #{params.begin_time}
|
||||
</if>
|
||||
<if test="params.end_time != null">
|
||||
AND
|
||||
ios.input_time <= #{params.end_time}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY ios.iostorinv_id Desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -27,4 +27,9 @@ public class GroupPlateDto extends GroupPlate{
|
||||
* 计划数量
|
||||
*/
|
||||
private BigDecimal plan_qty;
|
||||
|
||||
/**
|
||||
* 总数量
|
||||
*/
|
||||
private BigDecimal sum_qty;
|
||||
}
|
||||
|
||||
@@ -20,4 +20,14 @@ public class IOStorInvDisDto extends IOStorInvDis {
|
||||
*/
|
||||
private String material_name;
|
||||
|
||||
/**
|
||||
* 任务号
|
||||
*/
|
||||
private String task_code;
|
||||
|
||||
/**
|
||||
* 入库时间
|
||||
*/
|
||||
private String insert_time;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,499 @@
|
||||
package org.nl.wms.warehouse_management.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.IdUtil;
|
||||
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.basedata_manage.service.IBsrealStorattrService;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
|
||||
import org.nl.wms.basedata_manage.service.dao.BsrealStorattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IOutBillService;
|
||||
import org.nl.wms.warehouse_management.service.dao.IOStorInv;
|
||||
import org.nl.wms.warehouse_management.service.dao.IOStorInvDtl;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDisMapper;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDtlMapper;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvMapper;
|
||||
import org.nl.wms.warehouse_management.service.dto.IOStorInvDisDto;
|
||||
import org.nl.wms.warehouse_management.service.dto.IOStorInvDtlDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2025/5/29
|
||||
*/
|
||||
@Service
|
||||
public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> implements IOutBillService {
|
||||
|
||||
@Resource
|
||||
private IOStorInvMapper ioStorInvMapper;
|
||||
|
||||
@Resource
|
||||
private IOStorInvDisMapper ioStorInvDisMapper;
|
||||
|
||||
/**
|
||||
* 载具扩展属性mapper
|
||||
*/
|
||||
@Resource
|
||||
private MdPbStoragevehicleextMapper mdPbStoragevehicleextMapper;
|
||||
|
||||
@Resource
|
||||
private IBsrealStorattrService iBsrealStorattrService;
|
||||
|
||||
@Resource
|
||||
private IOStorInvDtlMapper ioStorInvDtlMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public IPage<IOStorInv> pageQuery(Map whereJson, PageQuery page, String[] stor_id, String[] bill_status, String[] bill_type) {
|
||||
HashMap<String, String> map = new HashMap<>(whereJson);
|
||||
|
||||
if (StrUtil.isNotEmpty(map.get("bill_code"))) {
|
||||
map.put("bill_code", "%" + map.get("bill_code") + "%");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(map.get("is_upload"))) {
|
||||
map.put("is_upload", map.get("is_upload"));
|
||||
}
|
||||
|
||||
// 空格查询
|
||||
if (StrUtil.isNotEmpty(map.get("pcsn"))) {
|
||||
// 判断是否有空格
|
||||
String pcsn = MapUtil.getStr(map, "pcsn");
|
||||
|
||||
boolean matches = pcsn.matches(".*\\s.*");
|
||||
|
||||
if (matches) {
|
||||
String[] s = pcsn.split(" ");
|
||||
String pcsn_in = String.join("','", Arrays.asList(s));
|
||||
|
||||
map.put("pcsn_in", "('"+pcsn_in+"')");
|
||||
map.put("pcsn", "");
|
||||
} else {
|
||||
map.put("pcsn", "%" + map.get("pcsn") + "%");
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(stor_id)) {
|
||||
String storIds = "(";
|
||||
for (int i = 0; i < stor_id.length; i++) {
|
||||
if (i != stor_id.length - 1) {
|
||||
storIds += "'" + stor_id[i] + "',";
|
||||
} else {
|
||||
storIds += "'" + stor_id[i] + "')";
|
||||
}
|
||||
}
|
||||
map.put("storIds", storIds);
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(bill_status)) {
|
||||
String billStatuses = "(";
|
||||
for (int i = 0; i < bill_status.length; i++) {
|
||||
if (i != bill_status.length - 1) {
|
||||
billStatuses += "'" + bill_status[i] + "',";
|
||||
} else {
|
||||
billStatuses += "'" + bill_status[i] + "')";
|
||||
}
|
||||
}
|
||||
map.put("billStatuses", billStatuses);
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(bill_type)) {
|
||||
String billTypes = "(";
|
||||
for (int i = 0; i < bill_type.length; i++) {
|
||||
if (i != bill_type.length - 1) {
|
||||
billTypes += "'" + bill_type[i] + "',";
|
||||
} else {
|
||||
billTypes += "'" + bill_type[i] + "')";
|
||||
}
|
||||
}
|
||||
map.put("billTypes", billTypes);
|
||||
}
|
||||
|
||||
return ioStorInvMapper.queryOutBillPage(new Page<>(page.getPage()+1,page.getSize()),map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<JSONObject> getCanuseIvt(Map whereJson, PageQuery page) {
|
||||
return mdPbStoragevehicleextMapper.getCanuseIvt(new Page<>(page.getPage() + 1, page.getSize()),
|
||||
whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String insertDtl(JSONObject map) {
|
||||
// if(MapUtil.getStr(map,"bill_type").equals("1011")) {
|
||||
// String iostorinv_id = inserdtlPic(map);
|
||||
// return iostorinv_id ;
|
||||
// }
|
||||
|
||||
//明细
|
||||
JSONArray array = map.getJSONArray("tableData");
|
||||
|
||||
map.remove("tableData");
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String user = map.getString("user");
|
||||
if (ObjectUtil.isNotEmpty(user)) {
|
||||
if ("mes".equals(user)) {
|
||||
currentUserId = "2";
|
||||
nickName = "mes用户";
|
||||
}
|
||||
if ("sap".equals(user)) {
|
||||
currentUserId = "3";
|
||||
nickName = "sap用户";
|
||||
}
|
||||
}
|
||||
String now = DateUtil.now();
|
||||
String iostorinv_id = IdUtil.getStringId();
|
||||
String bill_code = CodeUtil.getNewCode("OUT_STORE_CODE");
|
||||
|
||||
BsrealStorattr bsrealStorattr = iBsrealStorattrService.findById((String) map.get("stor_id"));
|
||||
map.put("iostorinv_id", iostorinv_id);
|
||||
map.put("bill_code", bill_code);
|
||||
map.put("biz_date", map.getString("biz_date").substring(0, 10));
|
||||
String bill_type = (String) map.get("bill_type");
|
||||
map.put("buss_type", bill_type.substring(0, 4));
|
||||
map.put("io_type", IOSEnum.IO_TYPE.code("出库"));
|
||||
map.put("detail_count", array.size() + "");
|
||||
map.put("create_mode", IOSEnum.CREATE_MODE.code("PC产生"));
|
||||
map.put("stor_code", bsrealStorattr.getStor_code());
|
||||
map.put("stor_name", bsrealStorattr.getStor_name());
|
||||
map.put("input_optid", currentUserId);
|
||||
map.put("input_optname", nickName);
|
||||
map.put("input_time", now);
|
||||
map.put("update_optid", currentUserId);
|
||||
map.put("update_optname", nickName);
|
||||
map.put("update_time", now);
|
||||
map.put("is_delete", BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
map.put("is_upload", BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
if (ObjectUtil.isNotEmpty(user)) {
|
||||
if (!"mes".equals(user) || "sap".equals(user)) {
|
||||
Long deptId = SecurityUtils.getDeptId();
|
||||
map.put("sysdeptid", deptId);
|
||||
map.put("syscompanyid", deptId);
|
||||
}
|
||||
}
|
||||
// 主表重量
|
||||
double qty = 0.0;
|
||||
// 明细数
|
||||
int num = array.size();
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JSONObject row = array.getJSONObject(i);
|
||||
// 校验计划数量不能为零
|
||||
double plan_qty = row.getDoubleValue("qty");
|
||||
if (Double.compare(plan_qty, 0.0) == 0) {
|
||||
throw new BadRequestException("数量不能为0");
|
||||
}
|
||||
|
||||
JSONObject ioStorInvDtl = new JSONObject();
|
||||
ioStorInvDtl.put("iostorinvdtl_id", IdUtil.getStringId());
|
||||
ioStorInvDtl.put("iostorinv_id", iostorinv_id);
|
||||
ioStorInvDtl.put("seq_no", (i + 1) + "");
|
||||
ioStorInvDtl.put("material_id", row.getString("material_id"));
|
||||
ioStorInvDtl.put("pcsn", row.getString("pcsn"));
|
||||
ioStorInvDtl.put("bill_status", IOSEnum.BILL_STATUS.code("生成"));
|
||||
ioStorInvDtl.put("qty_unit_id", row.get("qty_unit_id"));
|
||||
ioStorInvDtl.put("qty_unit_name", row.getString("qty_unit_name"));
|
||||
ioStorInvDtl.put("plan_qty", row.get("qty"));
|
||||
ioStorInvDtl.put("remark", row.getString("remark"));
|
||||
ioStorInvDtl.put("assign_qty", "0");
|
||||
ioStorInvDtl.put("unassign_qty", row.get("qty"));
|
||||
|
||||
ioStorInvDtlMapper.insert(ioStorInvDtl.toJavaObject(IOStorInvDtl.class));
|
||||
|
||||
qty += ioStorInvDtl.getDoubleValue("plan_qty");
|
||||
|
||||
}
|
||||
map.put("total_qty", qty);
|
||||
map.put("detail_count", num);
|
||||
|
||||
ioStorInvMapper.insert(map.toJavaObject(IOStorInv.class));
|
||||
|
||||
return iostorinv_id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IOStorInvDtlDto> getOutBillDtl(Map whereJson) {
|
||||
return ioStorInvMapper.getIODtl(whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IOStorInvDisDto> getOutBillDis(Map whereJson) {
|
||||
return ioStorInvDisMapper.queryOutBillDisDtl(whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void allDiv(JSONObject whereJson) {
|
||||
|
||||
//定义需要更新的仓位集合
|
||||
HashMap<String, JSONObject> Struct_map = new HashMap<String, JSONObject>();
|
||||
String iostorinv_id = whereJson.getString("iostorinv_id");
|
||||
|
||||
//查询主表信息
|
||||
IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinv_id);
|
||||
if (ObjectUtil.isEmpty(ioStorInv)) {
|
||||
throw new BadRequestException("查不到出库单信息");
|
||||
}
|
||||
|
||||
String bill_type = ioStorInv.getBill_type();
|
||||
|
||||
//查询生成和未分配完的明细
|
||||
JSONObject queryDtl = new JSONObject();
|
||||
queryDtl.put("bill_status", IOSEnum.BILL_STATUS.code("分配完"));
|
||||
queryDtl.put("unassign_flag", BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
queryDtl.put("iostorinv_id", iostorinv_id);
|
||||
queryDtl.put("iostorinvdtl_id", whereJson.getString("iostorinvdtl_id"));
|
||||
List<IOStorInvDtlDto> dtls = ioStorInvMapper.getIODtl(queryDtl);
|
||||
if (ObjectUtil.isEmpty(dtls)) {
|
||||
throw new BadRequestException("当前订单无可分配出库明细");
|
||||
}
|
||||
|
||||
for (int i = 0; i < dtls.size(); i++) {
|
||||
IOStorInvDtlDto dtl = dtls.get(i);
|
||||
double unassign_qty = dtl.getUnassign_qty().doubleValue();
|
||||
String pcsn = dtl.getPcsn();
|
||||
/*
|
||||
* 分配规则:
|
||||
* 1.按批次先进先出
|
||||
* 2.相同批次载具量小优先
|
||||
*/
|
||||
|
||||
|
||||
if (StrUtil.isBlank(pcsn)) {
|
||||
throw new BadRequestException("出库明细存在批次号为空");
|
||||
}
|
||||
// 根据批次号查询库存可用
|
||||
BigDecimal canuseSum = mdPbStoragevehicleextMapper.queryCanuseSumByPcsn(pcsn);
|
||||
|
||||
if (canuseSum.doubleValue()<unassign_qty){
|
||||
throw new BadRequestException("出库分配数量不满足");
|
||||
}
|
||||
|
||||
// boolean is_top3 = false;
|
||||
// if (ObjectUtil.isEmpty(dtl.getString("source_bill_code")) && ObjectUtil.isEmpty(dtl.getString("pcsn"))) {
|
||||
// is_top3 = true;
|
||||
// }
|
||||
// JSONObject jsonMap = new JSONObject();
|
||||
// // 已分配重量
|
||||
// double assign_qty = dtl.getDoubleValue("assign_qty");
|
||||
//
|
||||
// if (ObjectUtil.isNotEmpty(dtl.getString("source_bill_code")) || is_top3) {
|
||||
// while (unassign_qty > 0) {
|
||||
// // 1.有销售订单号
|
||||
// jsonMap.put("flag", "1");
|
||||
// jsonMap.put("material_id", dtl.getString("material_id"));
|
||||
// jsonMap.put("sale_order_name", dtl.getString("source_bill_code"));
|
||||
// jsonMap.put("sect_id", whereJson.getString("sect_id"));
|
||||
// jsonMap.put("stor_id", whereJson.getString("stor_id"));
|
||||
//
|
||||
// JSONObject jsonOneIvt = WQL.getWO("ST_OUTIVT01").addParamMap(jsonMap).process().uniqueResult(0);
|
||||
// if (ObjectUtil.isEmpty(jsonOneIvt)) {
|
||||
// throw new BadRequestException("库存不足");
|
||||
// }
|
||||
//
|
||||
// // 查询这一巷道所有此物料此库存此销售订单的库存
|
||||
// jsonMap.put("flag", "2");
|
||||
// jsonMap.put("row_num", jsonOneIvt.getString("row_num"));
|
||||
// jsonMap.put("block_num", jsonOneIvt.getString("block_num"));
|
||||
// JSONArray ivtAllArr = WQL.getWO("ST_OUTIVT01").addParamMap(jsonMap).process().getResultJSONArray(0);
|
||||
//
|
||||
// for (int j = 0; j < ivtAllArr.size(); j++) {
|
||||
// JSONObject ivt = ivtAllArr.getJSONObject(j);
|
||||
// double canuse_qty = ivt.getDoubleValue("canuse_qty");
|
||||
// assign_qty = NumberUtil.add(assign_qty, canuse_qty);
|
||||
//
|
||||
// if (unassign_qty >= canuse_qty) {
|
||||
// unassign_qty = NumberUtil.sub(unassign_qty, canuse_qty);
|
||||
// } else {
|
||||
// unassign_qty = 0;
|
||||
// }
|
||||
//
|
||||
// // 查询此木箱下的所有子卷
|
||||
// jsonMap.put("flag", "3");
|
||||
// jsonMap.put("storagevehicle_code", ivt.getString("storagevehicle_code"));
|
||||
// JSONArray ivtAllArr2 = WQL.getWO("ST_OUTIVT01").addParamMap(jsonMap).process().getResultJSONArray(0);
|
||||
//
|
||||
// for (int k = 0; k < ivtAllArr2.size(); k++) {
|
||||
// // 更新库存
|
||||
// JSONObject ivt2 = ivtAllArr2.getJSONObject(k);
|
||||
// ivt2.put("change_qty", ivt2.getDoubleValue("canuse_qty"));
|
||||
// ivt2.put("bill_type_scode", jo_mst.getString("bill_type"));
|
||||
// ivt2.put("inv_id", dtl.getString("iostorinv_id"));
|
||||
// ivt2.put("bill_code", jo_mst.getString("bill_code"));
|
||||
// ivt2.put("bill_table", "ST_IVT_IOStorInv");
|
||||
// storPublicService.IOStor(ivt2, "11");
|
||||
//
|
||||
// //生成分配明细
|
||||
// dtl.put("iostorinvdis_id", cn.hutool.core.util.IdUtil.getSnowflake(1, 1).nextId());
|
||||
// dtl.put("sect_id", ivt2.getString("sect_id"));
|
||||
// dtl.put("sect_code", ivt2.getString("sect_code"));
|
||||
// dtl.put("sect_name", ivt2.getString("sect_name"));
|
||||
// dtl.put("struct_id", ivt2.getString("struct_id"));
|
||||
// dtl.put("struct_code", ivt2.getString("struct_code"));
|
||||
// dtl.put("struct_name", ivt2.getString("struct_name"));
|
||||
// dtl.put("pcsn", ivt2.getString("pcsn"));
|
||||
// dtl.put("box_no", ivt2.getString("storagevehicle_code"));
|
||||
// dtl.put("storagevehicle_id", ivt2.getString("storagevehicle_id"));
|
||||
// dtl.put("storagevehicle_code", ivt2.getString("storagevehicle_code"));
|
||||
// dtl.put("storagevehicle_type", ivt2.getString("storagevehicle_type"));
|
||||
// dtl.put("is_issued", "0");
|
||||
// dtl.put("plan_qty", ivt2.getDoubleValue("change_qty"));
|
||||
// dtl.put("real_qty", ivt2.getDoubleValue("change_qty"));
|
||||
// dtl.put("is_overdue", ivt2.getString("is_overdue"));
|
||||
// dtl.put("instorage_time", ivt2.getString("instorage_time"));
|
||||
//
|
||||
// // 如果所属仓位是虚拟区 则将分配明细状态变为生成
|
||||
// JSONObject jsonSect = wo_sect.query("sect_id = '" + ivt2.getString("sect_id") + "'").uniqueResult(0);
|
||||
// if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) {
|
||||
// dtl.put("work_status", "01");
|
||||
// } else {
|
||||
// dtl.put("work_status", "00");
|
||||
// }
|
||||
//
|
||||
// if (jo_mst.getString("is_overdue").equals("1")) {
|
||||
// // 判断是否超期
|
||||
// if (ivt2.getString("is_overdue").equals("1")) {
|
||||
// dtl.put("work_status", "01");
|
||||
// }
|
||||
// }
|
||||
// wo_dis.insert(dtl);
|
||||
// }
|
||||
// //记录需锁定的仓位
|
||||
// Struct_map.put(ivt.getString("struct_id"), ivt);
|
||||
// // 为零结束
|
||||
// if (unassign_qty == 0) {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// } else {
|
||||
// // 确定子卷: 根据子卷找到库存出掉
|
||||
// jsonMap.put("flag", "1");
|
||||
// jsonMap.put("material_id", dtl.getString("material_id"));
|
||||
// jsonMap.put("pcsn", dtl.getString("pcsn"));
|
||||
// jsonMap.put("box_no", dtl.getString("box_no"));
|
||||
// jsonMap.put("sect_id", whereJson.getString("sect_id"));
|
||||
// jsonMap.put("stor_id", whereJson.getString("stor_id"));
|
||||
//
|
||||
// JSONObject jsonIvt = WQL.getWO("ST_OUTIVT01").addParamMap(jsonMap).process().uniqueResult(0);
|
||||
// if (ObjectUtil.isEmpty(jsonIvt)) {
|
||||
// throw new BadRequestException("库存不足");
|
||||
// }
|
||||
//
|
||||
// double canuse_qty ;
|
||||
// if (StrUtil.equals(bill_type, "1011")) {
|
||||
// canuse_qty = dtl.getDoubleValue("plan_qty");
|
||||
// } else {
|
||||
// canuse_qty = jsonIvt.getDoubleValue("canuse_qty");
|
||||
// }
|
||||
//
|
||||
// jsonIvt.put("change_qty", canuse_qty + "");
|
||||
// unassign_qty = 0;
|
||||
// assign_qty = NumberUtil.add(assign_qty, canuse_qty);
|
||||
//
|
||||
// //更新库存
|
||||
// jsonIvt.put("bill_type_scode", jo_mst.getString("bill_type"));
|
||||
// jsonIvt.put("inv_id", dtl.getString("iostorinv_id"));
|
||||
// jsonIvt.put("bill_code", jo_mst.getString("bill_code"));
|
||||
// jsonIvt.put("bill_table", "ST_IVT_IOStorInv");
|
||||
// storPublicService.IOStor(jsonIvt, "11");
|
||||
// //生成分配明细
|
||||
// dtl.put("iostorinvdis_id", cn.hutool.core.util.IdUtil.getSnowflake(1, 1).nextId());
|
||||
// dtl.put("sect_id", jsonIvt.getString("sect_id"));
|
||||
// dtl.put("sect_code", jsonIvt.getString("sect_code"));
|
||||
// dtl.put("sect_name", jsonIvt.getString("sect_name"));
|
||||
// dtl.put("struct_id", jsonIvt.getString("struct_id"));
|
||||
// dtl.put("struct_code", jsonIvt.getString("struct_code"));
|
||||
// dtl.put("struct_name", jsonIvt.getString("struct_name"));
|
||||
// dtl.put("pcsn", jsonIvt.getString("pcsn"));
|
||||
// dtl.put("box_no", jsonIvt.getString("storagevehicle_code"));
|
||||
// dtl.put("storagevehicle_id", jsonIvt.getString("storagevehicle_id"));
|
||||
// dtl.put("storagevehicle_code", jsonIvt.getString("storagevehicle_code"));
|
||||
// dtl.put("storagevehicle_type", jsonIvt.getString("storagevehicle_type"));
|
||||
// dtl.put("is_issued", "0");
|
||||
// dtl.put("plan_qty", jsonIvt.getDoubleValue("change_qty"));
|
||||
// dtl.put("real_qty", jsonIvt.getDoubleValue("change_qty"));
|
||||
// dtl.put("is_overdue", jsonIvt.getString("is_overdue"));
|
||||
// dtl.put("instorage_time", jsonIvt.getString("instorage_time"));
|
||||
// // 如果所属仓位是虚拟区 则将分配明细状态变为生成
|
||||
// JSONObject jsonSect = wo_sect.query("sect_id = '" + jsonIvt.getString("sect_id") + "'").uniqueResult(0);
|
||||
// if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) {
|
||||
// dtl.put("work_status", "01");
|
||||
// } else {
|
||||
// dtl.put("work_status", "00");
|
||||
// }
|
||||
//
|
||||
// // 判断是否超期
|
||||
// if (jo_mst.getString("is_overdue").equals("1")) {
|
||||
// if (jsonIvt.getString("is_overdue").equals("1")) {
|
||||
// dtl.put("work_status", "01");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// wo_dis.insert(dtl);
|
||||
//
|
||||
// //记录需锁定的仓位 (如果此明细有相同物料的且子卷号不能为空的则在最后一个明细分配完成后锁定仓位)
|
||||
// JSONObject map = new JSONObject();
|
||||
// map.put("flag", "5");
|
||||
// map.put("material_id", dtl.getString("material_id"));
|
||||
// map.put("box_no", dtl.getString("box_no"));
|
||||
// map.put("iostorinv_id", iostorinv_id);
|
||||
// map.put("iostorinvdtl_id", dtl.getString("iostorinvdtl_id"));
|
||||
// JSONArray dtlArr = WQL.getWO("ST_OUTIVT01").addParamMap(map).process().getResultJSONArray(0);
|
||||
// if (dtlArr.size() == 0) {
|
||||
// Struct_map.put(jsonIvt.getString("struct_id"), jsonIvt);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// HashMap<String, String> map_dtl = new HashMap<String, String>();
|
||||
// //更新明细
|
||||
// map_dtl.put("unassign_qty", unassign_qty + "");
|
||||
// map_dtl.put("assign_qty", assign_qty + "");
|
||||
// if (unassign_qty == 0) {
|
||||
// map_dtl.put("bill_status", "40");
|
||||
// } else {
|
||||
// map_dtl.put("bill_status", "30");
|
||||
// }
|
||||
// wo_dtl.update(map_dtl, "iostorinvdtl_id='" + dtl.getString("iostorinvdtl_id") + "'");
|
||||
//
|
||||
// //更新主表状态
|
||||
// this.updateMststatus(iostorinv_id);
|
||||
//
|
||||
// //锁定起点点位、仓位
|
||||
// Collection<JSONObject> c = Struct_map.values();
|
||||
// Iterator<JSONObject> it = c.iterator();
|
||||
// JSONObject from_start = new JSONObject();
|
||||
// from_start.put("lock_type", "3");
|
||||
// for (; it.hasNext(); ) {
|
||||
// JSONObject Struct = it.next();
|
||||
// from_start.put("struct_id", Struct.getString("struct_id"));
|
||||
// from_start.put("inv_type", jo_mst.getString("bill_type"));
|
||||
// from_start.put("inv_id", jo_mst.getString("iostorinv_id"));
|
||||
// from_start.put("inv_code", jo_mst.getString("bill_code"));
|
||||
// storPublicService.updateStructAndPoint(from_start);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,7 +19,9 @@ import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.basedata_manage.service.IBsrealStorattrService;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.BsrealStorattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleinfo;
|
||||
@@ -29,6 +31,8 @@ import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch_manage.service.dao.mapper.SchBasePointMapper;
|
||||
import org.nl.wms.sch_manage.service.util.AbstractTask;
|
||||
import org.nl.wms.sch_manage.service.util.tasks.StInTask;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IRawAssistIStorService;
|
||||
import org.nl.wms.warehouse_management.service.dao.GroupPlate;
|
||||
import org.nl.wms.warehouse_management.service.dao.IOStorInv;
|
||||
@@ -78,6 +82,9 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
@Resource
|
||||
private SchBasePointMapper schBasePointMapper;
|
||||
|
||||
@Resource
|
||||
private IMdPbStoragevehicleextService iMdPbStoragevehicleextService;
|
||||
|
||||
@Resource
|
||||
private GroupPlateMapper groupPlateMapper;
|
||||
|
||||
@@ -126,7 +133,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
|
||||
@Override
|
||||
public IPage<GroupPlateDto> getBillDtl(Map whereJson, PageQuery page) {
|
||||
return ioStorInvMapper.getBillDtl(new Page<>(page.getPage()+1,page.getSize()),whereJson);
|
||||
return ioStorInvMapper.getGroupPlate(new Page<>(page.getPage()+1,page.getSize()),whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -142,7 +149,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
io_mst.put("iostorinv_id", iostorinv_id);
|
||||
io_mst.put("bill_code", bill_code);
|
||||
io_mst.put("buss_type", ((String) whereJson.get("bill_type")).substring(0, 4));
|
||||
io_mst.put("io_type", "0");
|
||||
io_mst.put("io_type", IOSEnum.IO_TYPE.code("入库"));
|
||||
io_mst.put("bill_type", whereJson.get("bill_type"));
|
||||
io_mst.put("biz_date", whereJson.get("biz_date").toString().substring(0, 10));
|
||||
BsrealStorattr bsrealStorattr = iBsrealStorattrService.findById((String) whereJson.get("stor_id"));
|
||||
@@ -154,15 +161,15 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
io_mst.put("detail_count", rows.size());
|
||||
io_mst.put("remark", whereJson.get("remark"));
|
||||
io_mst.put("bill_status", whereJson.get("bill_status"));
|
||||
io_mst.put("create_mode", "01");
|
||||
io_mst.put("create_mode", IOSEnum.CREATE_MODE.code("PC产生"));
|
||||
io_mst.put("input_optid", currentUserId + "");
|
||||
io_mst.put("input_optname", nickName);
|
||||
io_mst.put("input_time", now);
|
||||
io_mst.put("update_optid", currentUserId + "");
|
||||
io_mst.put("update_optname", nickName);
|
||||
io_mst.put("update_time", now);
|
||||
io_mst.put("is_delete", "0");
|
||||
io_mst.put("is_upload", "0");
|
||||
io_mst.put("is_delete", BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
io_mst.put("is_upload", BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
Long deptId = SecurityUtils.getDeptId();
|
||||
io_mst.put("sysdeptid", deptId + "");
|
||||
io_mst.put("syscompanyid", deptId + "");
|
||||
@@ -176,7 +183,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
ioStorInvDtl.put("seq_no",(i + 1)+"");
|
||||
ioStorInvDtl.put("material_id",row.get("material_id"));
|
||||
ioStorInvDtl.put("Pcsn",row.get("pcsn"));
|
||||
ioStorInvDtl.put("bill_status","10");
|
||||
ioStorInvDtl.put("bill_status",IOSEnum.BILL_STATUS.code("生成"));
|
||||
ioStorInvDtl.put("qty_unit_id",row.get("qty_unit_id"));
|
||||
ioStorInvDtl.put("qty_unit_name",row.get("qty_unit_name"));
|
||||
ioStorInvDtl.put("assign_qty","0");
|
||||
@@ -184,15 +191,6 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
ioStorInvDtl.put("plan_qty",row.get("plan_qty"));
|
||||
total_qty += Double.parseDouble(row.get("qty").toString());
|
||||
|
||||
//判断该木箱是否已经生成入库单
|
||||
//判断该载具是否已经分配货位或者起点
|
||||
// JSONArray now_dis_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag", "18").addParam("box_no", row.get("package_box_sn")).process().getResultJSONArray(0);
|
||||
// if (now_dis_rows.size() > 0) {
|
||||
// throw new BadRequestException("该木箱已经分配过货位,无法继续分配!");
|
||||
// }
|
||||
//判断该木箱是否已经存在库内
|
||||
// JSONObject str_jo = WQLObject.getWQLObject("st_ivt_structattr").query("storagevehicle_code = '" + row.get("package_box_sn") + "'").uniqueResult(0);
|
||||
|
||||
//判断该载具编号是否已经存在库内
|
||||
Structattr structattr = iStructattrService.getOne(new LambdaQueryWrapper<>(Structattr.class).eq(Structattr::getStoragevehicle_code,row.get("storagevehicle_code")));
|
||||
if (ObjectUtil.isNotEmpty(structattr)) {
|
||||
@@ -209,8 +207,8 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
dis.put("material_id", row.get("material_id"));
|
||||
dis.put("pcsn", row.get("pcsn"));
|
||||
dis.put("storagevehicle_code", row.get("storagevehicle_code"));
|
||||
dis.put("work_status", "00");
|
||||
dis.put("is_issued", 0);
|
||||
dis.put("work_status", IOSEnum.INBILL_DIS_STATUS.code("生成"));
|
||||
dis.put("is_issued", BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
dis.put("qty_unit_id", row.get("qty_unit_id"));
|
||||
dis.put("qty_unit_name", row.get("qty_unit_name"));
|
||||
dis.put("plan_qty", row.get("plan_qty"));
|
||||
@@ -231,7 +229,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
for (Long id : ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("iostorinv_id", String.valueOf(id));
|
||||
param.put("is_delete", "1");
|
||||
param.put("is_delete", BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", now);
|
||||
@@ -248,16 +246,13 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
|
||||
IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinv_id);
|
||||
|
||||
if (!"10".equals(ioStorInv.getBill_status())) {
|
||||
if (!IOSEnum.BILL_STATUS.code("生成").equals(ioStorInv.getBill_status())) {
|
||||
throw new BadRequestException("主表状态必须为生成!");
|
||||
}
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
// whereJson.put("update_optid", currentUserId + "");
|
||||
// whereJson.put("update_optname", nickName);
|
||||
// whereJson.put("update_time", now);
|
||||
|
||||
JSONObject iostorinv_json = new JSONObject();
|
||||
iostorinv_json.put("iostorinv_id",iostorinv_id);
|
||||
@@ -272,53 +267,15 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
iostorinv_json.put("update_optid",currentUserId);
|
||||
iostorinv_json.put("update_optname",nickName);
|
||||
iostorinv_json.put("update_time",now);
|
||||
// iostorinv_json.putAll(whereJson);
|
||||
|
||||
ioStorInvMapper.updateById(iostorinv_json.toJavaObject(IOStorInv.class));
|
||||
|
||||
// wo.update(whereJson);
|
||||
//先删除该单据下的所有明细
|
||||
ioStorInvDtlMapper.delete(new LambdaQueryWrapper<>(IOStorInvDtl.class).eq(IOStorInvDtl::getIostorinv_id,iostorinv_id));
|
||||
|
||||
ioStorInvDisMapper.delete(new LambdaQueryWrapper<>(IOStorInvDis.class).eq(IOStorInvDis::getIostorinv_id,iostorinv_id));
|
||||
ArrayList<HashMap> rows = (ArrayList<HashMap>) whereJson.get("tableData");
|
||||
// for (int i = 0; i < rows.size(); i++) {
|
||||
// HashMap<String, String> row = rows.get(i);
|
||||
// row.put("iostorinvdtl_id", cn.hutool.core.util.IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||
// row.put("iostorinv_id", iostorinv_id);
|
||||
// row.put("seq_no", (i + 1) + "");
|
||||
// JSONObject material = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + row.get("product_name") + "'").uniqueResult(0);
|
||||
// if (ObjectUtil.isEmpty(material)) {
|
||||
// throw new BadRequestException("LMS系统不存在物料:【" + row.get("product_name") + "】,请确认物料是否正确,或SAP系统是否推送到LMS系统");
|
||||
// }
|
||||
// row.put("material_id", material.getString("material_id"));
|
||||
// row.put("pcsn", row.get("container_name"));
|
||||
// row.put("bill_status", "10");
|
||||
// row.put("quality_scode", "01");
|
||||
// row.put("qty_unit_id", material.getString("base_unit_id"));
|
||||
// JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("measure_unit_id = '" + material.getString("base_unit_id") + "'").uniqueResult(0);
|
||||
// row.put("qty_unit_name", unit.getString("unit_name"));
|
||||
// row.put("assign_qty", row.get("net_weight"));
|
||||
// row.put("plan_qty", row.get("net_weight"));
|
||||
// String net_weight = row.get("net_weight");
|
||||
// row.put("box_no", row.get("package_box_sn"));
|
||||
//
|
||||
// WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(row);
|
||||
//
|
||||
// JSONObject dis = new JSONObject();
|
||||
// dis.put("iostorinvdis_id", cn.hutool.core.util.IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||
// dis.put("iostorinv_id", iostorinv_id);
|
||||
// dis.put("iostorinvdtl_id", row.get("iostorinvdtl_id"));
|
||||
// dis.put("seq_no", 1);
|
||||
// dis.put("material_id", row.get("material_id"));
|
||||
// dis.put("pcsn", row.get("pcsn"));
|
||||
// dis.put("box_no", row.get("box_no"));
|
||||
// dis.put("quality_scode", row.get("quality_scode"));
|
||||
// dis.put("work_status", "00");
|
||||
// dis.put("qty_unit_id", material.getString("base_unit_id"));
|
||||
// dis.put("qty_unit_name", unit.getString("unit_name"));
|
||||
// dis.put("plan_qty", row.get("plan_qty"));
|
||||
// WQLObject.getWQLObject("ST_IVT_IOStorInvDis").insert(dis);
|
||||
// }
|
||||
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
HashMap<String, Object> row = rows.get(i);
|
||||
JSONObject ioStorInvDtl = new JSONObject();
|
||||
@@ -328,21 +285,11 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
ioStorInvDtl.put("seq_no",(i + 1)+"");
|
||||
ioStorInvDtl.put("material_id",row.get("material_id"));
|
||||
ioStorInvDtl.put("Pcsn",row.get("pcsn"));
|
||||
ioStorInvDtl.put("bill_status","10");
|
||||
ioStorInvDtl.put("bill_status",IOSEnum.BILL_STATUS.code("生成"));
|
||||
ioStorInvDtl.put("qty_unit_id",row.get("qty_unit_id"));
|
||||
ioStorInvDtl.put("qty_unit_name",row.get("qty_unit_name"));
|
||||
ioStorInvDtl.put("assign_qty",row.get("qty"));
|
||||
ioStorInvDtl.put("plan_qty",row.get("plan_qty"));
|
||||
// total_qty += Double.parseDouble(row.get("qty").toString());
|
||||
|
||||
//判断该木箱是否已经生成入库单
|
||||
//判断该载具是否已经分配货位或者起点
|
||||
// JSONArray now_dis_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag", "18").addParam("box_no", row.get("package_box_sn")).process().getResultJSONArray(0);
|
||||
// if (now_dis_rows.size() > 0) {
|
||||
// throw new BadRequestException("该木箱已经分配过货位,无法继续分配!");
|
||||
// }
|
||||
//判断该木箱是否已经存在库内
|
||||
// JSONObject str_jo = WQLObject.getWQLObject("st_ivt_structattr").query("storagevehicle_code = '" + row.get("package_box_sn") + "'").uniqueResult(0);
|
||||
|
||||
//判断该载具编号是否已经存在库内
|
||||
Structattr structattr = iStructattrService.getOne(new LambdaQueryWrapper<>(Structattr.class).eq(Structattr::getStoragevehicle_code,row.get("storagevehicle_code")));
|
||||
@@ -360,8 +307,8 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
dis.put("material_id", row.get("material_id"));
|
||||
dis.put("pcsn", row.get("pcsn"));
|
||||
dis.put("storagevehicle_code", row.get("storagevehicle_code"));
|
||||
dis.put("work_status", "00");
|
||||
dis.put("is_issued", 0);
|
||||
dis.put("work_status", IOSEnum.INBILL_DIS_STATUS.code("生成"));
|
||||
dis.put("is_issued", BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
dis.put("qty_unit_id", row.get("qty_unit_id"));
|
||||
dis.put("qty_unit_name", row.get("qty_unit_name"));
|
||||
dis.put("plan_qty", row.get("plan_qty"));
|
||||
@@ -378,6 +325,11 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void divStruct(Map whereJson) {
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
String sect_id = "";
|
||||
String sect_code = "";
|
||||
String sect_name = "";
|
||||
@@ -455,7 +407,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
lock_map.put("inv_type", ioStorInv.getBill_type());
|
||||
iStructattrService.updateStatusByCode("0",lock_map);
|
||||
|
||||
// 修改分配明细表
|
||||
// 更新分配明细表
|
||||
ioStorInvDisMapper.update(dis_map.toJavaObject(IOStorInvDis.class),new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getSect_id,dis_map.getString("sect_id"))
|
||||
.set(IOStorInvDis::getSect_code,dis_map.getString("sect_code"))
|
||||
@@ -469,7 +421,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
//维护单据明细表里 分配数量
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("iostorinvdtl_id",map.get("iostorinvdtl_id"));
|
||||
jsonObject.put("bill_status","30");
|
||||
jsonObject.put("bill_status",IOSEnum.BILL_STATUS.code("分配完"));
|
||||
jsonObject.put("assign_qty",map.get("plan_qty"));
|
||||
jsonObject.put("unassign_qty","0");
|
||||
ioStorInvDtlMapper.updateById(jsonObject.toJavaObject(IOStorInvDtl.class));
|
||||
@@ -482,19 +434,21 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
// 根据分配货位情况 更新主表单据状态
|
||||
IOStorInv ios = new IOStorInv();
|
||||
ios.setIostorinv_id(map.get("iostorinv_id"));
|
||||
ios.setBill_status(disCount>0 ? "20" : "30");
|
||||
ios.setUpdate_optid(currentUserId);
|
||||
ios.setUpdate_optname(nickName);
|
||||
ios.setUpdate_time(now);
|
||||
ios.setBill_status(disCount>0 ? IOSEnum.BILL_STATUS.code("分配中") : IOSEnum.BILL_STATUS.code("分配完"));
|
||||
ioStorInvMapper.updateById(ios);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allDivStruct(JSONObject form) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void unDivStruct(Map whereJson) {
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
ArrayList<HashMap> rows = (ArrayList<HashMap>) whereJson.get("tableMater");
|
||||
HashMap<String, String> jo = rows.get(0);
|
||||
|
||||
@@ -520,7 +474,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
//维护单据明细表里 分配数量
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("iostorinvdtl_id",jo.get("iostorinvdtl_id"));
|
||||
jsonObject.put("bill_status","10");
|
||||
jsonObject.put("bill_status",IOSEnum.BILL_STATUS.code("生成"));
|
||||
jsonObject.put("assign_qty","0");
|
||||
jsonObject.put("unassign_qty",jo.get("plan_qty"));
|
||||
ioStorInvDtlMapper.updateById(jsonObject.toJavaObject(IOStorInvDtl.class));
|
||||
@@ -533,7 +487,10 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
// 根据分配货位情况 更新主表单据状态
|
||||
IOStorInv ios = new IOStorInv();
|
||||
ios.setIostorinv_id(jo.get("iostorinv_id"));
|
||||
ios.setBill_status(disCount>0 ? "20" : "10");
|
||||
ios.setUpdate_optid(currentUserId);
|
||||
ios.setUpdate_optname(nickName);
|
||||
ios.setUpdate_time(now);
|
||||
ios.setBill_status(disCount>0 ? IOSEnum.BILL_STATUS.code("分配中") : IOSEnum.BILL_STATUS.code("生成"));
|
||||
ioStorInvMapper.updateById(ios);
|
||||
}
|
||||
|
||||
@@ -559,10 +516,10 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
task_form.put("PickingLocation", point_code);
|
||||
task_form.put("PlacedLocation", ioStorInvDis.getStruct_code());
|
||||
task_form.put("vehicle_code", map.get("storagevehicle_code"));
|
||||
GroupPlate groupPlate = groupPlateMapper.selectOne(new LambdaQueryWrapper<>(GroupPlate.class)
|
||||
.eq(GroupPlate::getStoragevehicle_code,map.get("storagevehicle_code"))
|
||||
);
|
||||
task_form.put("group_id", groupPlate.getGroup_id());
|
||||
// GroupPlate groupPlate = groupPlateMapper.selectOne(new LambdaQueryWrapper<>(GroupPlate.class)
|
||||
// .eq(GroupPlate::getStoragevehicle_code,map.get("storagevehicle_code"))
|
||||
// );
|
||||
// task_form.put("group_id", groupPlate.getGroup_id());
|
||||
|
||||
StInTask stInTask = SpringContextHolder.getBean("STInTask");
|
||||
|
||||
@@ -571,69 +528,91 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
//分配明细表更新任务相关数据
|
||||
IOStorInvDis dis = new IOStorInvDis();
|
||||
dis.setIostorinvdis_id(map.get("iostorinvdis_id"));
|
||||
dis.setWork_status("01");
|
||||
dis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("执行中"));
|
||||
dis.setTask_id(task_id);
|
||||
dis.setIs_issued(BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
dis.setPoint_code(point_code);
|
||||
ioStorInvDisMapper.updateById(dis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTask(Map whereJson) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delTask(Map whereJson) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reIssueTask(Map whereJson) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirmTask(Map whereJson) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelTask(Map whereJson) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void confirm(Map whereJson) {
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
IOStorInv ioStorInv = ioStorInvMapper.selectOne(new LambdaQueryWrapper<>(IOStorInv.class)
|
||||
.eq(IOStorInv::getIostorinv_id,whereJson.get("iostorinv_id"))
|
||||
);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(ioStorInv) && !"20".equals(ioStorInv.getBill_status()) && !"30".equals(ioStorInv.getBill_status())){
|
||||
throw new BadRequestException("主表状态必须为分配中、分配完!");
|
||||
if (ObjectUtil.isNotEmpty(ioStorInv) && !IOSEnum.BILL_STATUS.code("分配完").equals(ioStorInv.getBill_status())){
|
||||
throw new BadRequestException("主表状态必须为分配完!");
|
||||
}
|
||||
|
||||
// 分配明细中 任务状态必须全部完成
|
||||
int count = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
//解锁原货位点位
|
||||
List<IOStorInvDis> storInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinv_id,whereJson.get("iostorinv_id"))
|
||||
.lt(IOStorInvDis::getWork_status,"99")
|
||||
);
|
||||
if (count > 0){
|
||||
throw new BadRequestException("存在未完成的作业");
|
||||
|
||||
for (IOStorInvDis ioStorInvDis: storInvDisList){
|
||||
if (StrUtil.isNotBlank(ioStorInvDis.getStruct_code())){
|
||||
JSONObject finish_map = new JSONObject();
|
||||
finish_map.put("struct_code",ioStorInvDis.getStruct_code());
|
||||
finish_map.put("storagevehicle_code",ioStorInvDis.getStoragevehicle_code());
|
||||
finish_map.put("inv_type", null);
|
||||
finish_map.put("inv_id", null);
|
||||
finish_map.put("inv_code", null);
|
||||
iStructattrService.updateStatusByCode("1",finish_map);
|
||||
|
||||
//修改库存
|
||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_ADD_CANUSE);
|
||||
jsonIvt.put("storagevehicle_code", ioStorInvDis.getStoragevehicle_code());
|
||||
jsonIvt.put("material_id", ioStorInvDis.getMaterial_id());
|
||||
jsonIvt.put("pcsn", ioStorInvDis.getPcsn());
|
||||
jsonIvt.put("qty_unit_id", ioStorInvDis.getQty_unit_id());
|
||||
jsonIvt.put("qty_unit_name", ioStorInvDis.getQty_unit_name());
|
||||
jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty());
|
||||
updateIvtList.add(jsonIvt);
|
||||
iMdPbStoragevehicleextService.updateIvt(updateIvtList);
|
||||
}
|
||||
|
||||
//更新详情数据
|
||||
ioStorInvDisMapper.update(ioStorInvDis,new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
.set(IOStorInvDis::getReal_qty,ioStorInvDis.getPlan_qty())
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,ioStorInvDis.getIostorinvdis_id())
|
||||
.ne(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
);
|
||||
|
||||
ioStorInvDtlMapper.update(new IOStorInvDtl(),new LambdaUpdateWrapper<>(IOStorInvDtl.class)
|
||||
.set(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||
.set(IOStorInvDtl::getReal_qty,ioStorInvDis.getPlan_qty())
|
||||
.eq(IOStorInvDtl::getIostorinvdtl_id,ioStorInvDis.getIostorinvdtl_id())
|
||||
.ne(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||
);
|
||||
|
||||
//更新组盘记录表
|
||||
groupPlateMapper.update(new GroupPlate(),new LambdaUpdateWrapper<>(GroupPlate.class)
|
||||
.set(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
||||
.eq(GroupPlate::getPcsn,ioStorInvDis.getPcsn())
|
||||
.eq(GroupPlate::getMaterial_id,ioStorInvDis.getMaterial_id())
|
||||
.eq(GroupPlate::getStoragevehicle_code,ioStorInvDis.getStoragevehicle_code())
|
||||
);
|
||||
}
|
||||
|
||||
//将明细全部变成99
|
||||
ioStorInvDtlMapper.update(new IOStorInvDtl(),new LambdaUpdateWrapper<>(IOStorInvDtl.class)
|
||||
.set(IOStorInvDtl::getBill_status,"99")
|
||||
.eq(IOStorInvDtl::getIostorinv_id,whereJson.get("iostorinv_id"))
|
||||
//更新主表状态
|
||||
ioStorInvMapper.update(ioStorInv,new LambdaUpdateWrapper<>(IOStorInv.class)
|
||||
.set(IOStorInv::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||
.set(IOStorInv::getConfirm_optid,currentUserId)
|
||||
.set(IOStorInv::getConfirm_optname,nickName)
|
||||
.set(IOStorInv::getConfirm_time,now)
|
||||
.eq(IOStorInv::getIostorinv_id,whereJson.get("iostorinv_id"))
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void backConfirm(Map whereJson) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -643,11 +622,6 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
return ioStorInvDisMapper.queryInBillDisDtlByIosId(iostorinvdtl_id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray queryTask(Map whereJson) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Structattr autoDis(JSONObject whereJson) {
|
||||
String sect_id = whereJson.getString("sect_id");
|
||||
@@ -655,7 +629,8 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
// 查询没有任务的仓位号
|
||||
List<Structattr> structattrList = iStructattrService.list(new LambdaQueryWrapper<>(Structattr.class)
|
||||
.eq(Structattr::getSect_id,sect_id)
|
||||
.eq(Structattr::getLock_type,"00")
|
||||
.eq(Structattr::getLock_type,IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.isNull(Structattr::getStoragevehicle_code).or().eq(Structattr::getStoragevehicle_code,"")
|
||||
);
|
||||
if (ObjectUtil.isEmpty(structattrList)){
|
||||
throw new BadRequestException("该库区没有仓位");
|
||||
@@ -681,7 +656,8 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject autoDisMove(JSONObject whereJson) {
|
||||
return null;
|
||||
public List<IOStorInvDisDto> getInBillTaskDtl(Map whereJson) {
|
||||
String iostorinvdtl_id = (String) whereJson.get("iostorinvdtl_id");
|
||||
return ioStorInvDisMapper.getInBillTaskDtl(iostorinvdtl_id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user