|
|
@ -8,14 +8,27 @@ import cn.hutool.core.util.StrUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.nl.b_lms.pdm.storagevehicleext.service.IMdPbStoragevehicleextService; |
|
|
|
import org.nl.b_lms.sch.task.dao.SchBaseTask; |
|
|
|
import org.nl.b_lms.sch.task.service.IschBaseTaskService; |
|
|
|
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum; |
|
|
|
import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtMoveinvService; |
|
|
|
import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtMoveinvdtlService; |
|
|
|
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.StIvtMoveinv; |
|
|
|
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.StIvtMoveinvdtl; |
|
|
|
import org.nl.b_lms.storage_manage.st.dao.StIvtStructattr; |
|
|
|
import org.nl.b_lms.storage_manage.st.service.StIvtBsrealstorattrService; |
|
|
|
import org.nl.b_lms.storage_manage.st.service.StIvtStructattrService; |
|
|
|
import org.nl.common.domain.query.PageQuery; |
|
|
|
import org.nl.common.utils.CodeUtil; |
|
|
|
import org.nl.common.utils.SecurityUtils; |
|
|
|
import org.nl.modules.common.exception.BadRequestException; |
|
|
|
import org.nl.common.utils.CodeUtil; |
|
|
|
import org.nl.modules.wql.WQL; |
|
|
|
import org.nl.modules.wql.core.bean.WQLObject; |
|
|
|
import org.nl.modules.wql.util.WqlUtil; |
|
|
@ -23,7 +36,7 @@ import org.nl.wms.basedata.st.service.impl.UserStorServiceImpl; |
|
|
|
import org.nl.wms.sch.manage.TaskStatusEnum; |
|
|
|
import org.nl.wms.st.inbill.service.StorPublicService; |
|
|
|
import org.nl.wms.st.instor.service.HandMoveStorService; |
|
|
|
import org.nl.wms.st.instor.task.EmpMoveTask; |
|
|
|
import org.nl.wms.st.instor.service.dto.MoveInvPageParam; |
|
|
|
import org.nl.wms.st.instor.task.HandMoveStorAcsTask; |
|
|
|
import org.springframework.data.domain.Pageable; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -39,82 +52,64 @@ import java.util.*; |
|
|
|
@Slf4j |
|
|
|
public class HandMoveStorServiceImpl implements HandMoveStorService { |
|
|
|
private final StorPublicService storPublicService; |
|
|
|
/** 移库主表 */ |
|
|
|
/** |
|
|
|
* 移库主表 |
|
|
|
*/ |
|
|
|
private final IStIvtMoveinvService moveinvService; |
|
|
|
private final StIvtBsrealstorattrService bsrealstorattrService; |
|
|
|
/** |
|
|
|
* 仓位属性表 |
|
|
|
*/ |
|
|
|
private final StIvtStructattrService structattrService; |
|
|
|
/** |
|
|
|
* 任务表 |
|
|
|
*/ |
|
|
|
private final IschBaseTaskService taskService; |
|
|
|
private final IStIvtMoveinvdtlService moveinvdtlService; |
|
|
|
private final IMdPbStoragevehicleextService storagevehicleextService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Object> pageQuery(Map whereJson, Pageable page) { |
|
|
|
HashMap<String, String> map = new HashMap<>(whereJson); |
|
|
|
map.put("flag", "1"); |
|
|
|
if (StrUtil.isNotEmpty(map.get("bill_code"))) { |
|
|
|
map.put("bill_code", "%" + map.get("bill_code") + "%"); |
|
|
|
} |
|
|
|
if (StrUtil.isNotEmpty(map.get("material_code"))) { |
|
|
|
map.put("material_code", "%" + map.get("material_code") + "%"); |
|
|
|
} |
|
|
|
if (StrUtil.isNotEmpty(map.get("buss_type"))) { |
|
|
|
map.put("buss_type", whereJson.get("buss_type") + "%"); |
|
|
|
} |
|
|
|
|
|
|
|
//获取人员对应的仓库
|
|
|
|
UserStorServiceImpl userStorService = new UserStorServiceImpl(); |
|
|
|
String in_stor_id = userStorService.getInStor(); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(in_stor_id)) { |
|
|
|
map.put("in_stor_id", in_stor_id); |
|
|
|
} |
|
|
|
|
|
|
|
JSONObject jo = WQL.getWO("QST_IVT_HANDMOVESTOR").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "bill_code desc"); |
|
|
|
return jo; |
|
|
|
public IPage<StIvtMoveinv> pageQuery(MoveInvPageParam param, PageQuery page) { |
|
|
|
List<String> storeForUser = bsrealstorattrService.getStoreForUser(SecurityUtils.getCurrentUserId()); |
|
|
|
param.setStor_ids(storeForUser); |
|
|
|
IPage<StIvtMoveinv> pages = new Page<>(page.getPage() + 1, page.getSize()); |
|
|
|
pages = moveinvService.moveStoragePage(pages, param); |
|
|
|
return pages; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void deleteAll(Long[] ids) { |
|
|
|
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_MoveInv"); |
|
|
|
|
|
|
|
for (Long moveinv_id : ids) { |
|
|
|
JSONObject jo_mst = wo_mst.query("moveinv_id='" + moveinv_id + "'").uniqueResult(0); |
|
|
|
|
|
|
|
if (jo_mst.getString("stor_id").equals(IOSEnum.STOR_ID.code("二期"))) { |
|
|
|
this.deleteByIdTwo(moveinv_id + ""); |
|
|
|
} |
|
|
|
this.deleteByIdTwo(moveinv_id + ""); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 主表标记删除、明细删除 |
|
|
|
* 通过moveinv_id删除明细,还原库存等操作(二期) |
|
|
|
* |
|
|
|
* @param moveinv_id |
|
|
|
* @param moveinv_id 主表id |
|
|
|
*/ |
|
|
|
public void deleteByIdTwo(String moveinv_id) { |
|
|
|
//明细表
|
|
|
|
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_MoveInvDtl"); |
|
|
|
//主表
|
|
|
|
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_MoveInv"); |
|
|
|
//任务表
|
|
|
|
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task"); |
|
|
|
//仓位表
|
|
|
|
WQLObject wo_Attr = WQLObject.getWQLObject("st_ivt_structattr"); |
|
|
|
|
|
|
|
String currentUserId = SecurityUtils.getCurrentUserId(); |
|
|
|
String nickName = SecurityUtils.getCurrentNickName(); |
|
|
|
String now = DateUtil.now(); |
|
|
|
HashMap<String, String> map = new HashMap<>(); |
|
|
|
map.put("is_delete", "1"); |
|
|
|
map.put("update_optid", currentUserId + ""); |
|
|
|
map.put("update_optname", nickName); |
|
|
|
map.put("update_time", now); |
|
|
|
JSONObject jo_mst = wo_mst.query("moveinv_id='" + moveinv_id + "'").uniqueResult(0); |
|
|
|
JSONArray ja = wo_dtl.query("moveinv_id='" + moveinv_id + "'").getResultJSONArray(0); |
|
|
|
LambdaUpdateWrapper<StIvtMoveinv> invUpLam = new LambdaUpdateWrapper<>(); |
|
|
|
invUpLam.set(StIvtMoveinv::getIs_delete, "1") |
|
|
|
.set(StIvtMoveinv::getUpdate_optid, currentUserId) |
|
|
|
.set(StIvtMoveinv::getUpdate_optname, nickName) |
|
|
|
.set(StIvtMoveinv::getUpdate_time, now); |
|
|
|
StIvtMoveinv jo_mst = moveinvService.getById(moveinv_id); |
|
|
|
List<JSONObject> ja = moveinvdtlService.getByMoveInvIdToObject(moveinv_id); |
|
|
|
String point_code2 = ""; |
|
|
|
for (int i = 0; i < ja.size(); i++) { |
|
|
|
JSONObject jo = ja.getJSONObject(i); |
|
|
|
//删除任务
|
|
|
|
HashMap<String, String> task_map = new HashMap<>(); |
|
|
|
task_map.put("is_delete", "1"); |
|
|
|
point_code2 = wo_Task.query("task_id = '" + jo.getString("task_id") + "'").uniqueResult(0).getString("point_code2"); |
|
|
|
wo_Task.update(task_map, "task_id='" + jo.getString("task_id") + "'"); |
|
|
|
JSONObject jo = ja.get(i); |
|
|
|
//删除任务 todo: 是否需要判空
|
|
|
|
SchBaseTask taskObj = taskService.getById(jo.getString("task_id")); |
|
|
|
point_code2 = taskObj.getPoint_code2(); |
|
|
|
taskObj.setIs_delete("1"); |
|
|
|
taskService.updateById(taskObj); |
|
|
|
//解锁起点点位、仓位
|
|
|
|
JSONObject from_start = new JSONObject(); |
|
|
|
from_start.put("lock_type", "1"); |
|
|
@ -129,47 +124,41 @@ public class HandMoveStorServiceImpl implements HandMoveStorService { |
|
|
|
//更新移出库存
|
|
|
|
jo.put("struct_id", jo.getString("turnout_struct_id")); |
|
|
|
jo.put("change_qty", jo.getDoubleValue("qty")); |
|
|
|
jo.put("bill_type_scode", jo_mst.getString("bill_type")); |
|
|
|
jo.put("bill_type_scode", jo_mst.getBill_type()); |
|
|
|
jo.put("inv_id", jo.getString("moveinvdtl_id")); |
|
|
|
jo.put("bill_code", jo_mst.getString("bill_code")); |
|
|
|
jo.put("bill_code", jo_mst.getBill_code()); |
|
|
|
jo.put("bill_table", "ST_IVT_MoveInv"); |
|
|
|
storPublicService.IOStor(jo, "12"); |
|
|
|
//更新移入库存
|
|
|
|
jo.put("struct_id", jo.getString("turnin_struct_id")); |
|
|
|
jo.put("bill_type_scode", jo_mst.getString("bill_type")); |
|
|
|
jo.put("bill_type_scode", jo_mst.getBill_type()); |
|
|
|
jo.put("inv_id", jo.getString("moveinvdtl_id")); |
|
|
|
jo.put("bill_code", jo_mst.getString("bill_code")); |
|
|
|
jo.put("bill_code", jo_mst.getBill_code()); |
|
|
|
jo.put("bill_table", "ST_IVT_MoveInv"); |
|
|
|
storPublicService.IOStor(jo, "32"); |
|
|
|
//删除明细
|
|
|
|
wo_dtl.delete("moveinvdtl_id='" + jo.getString("moveinvdtl_id") + "'"); |
|
|
|
moveinvdtlService.removeById(jo.getString("moveinvdtl_id")); |
|
|
|
} |
|
|
|
//更新主表
|
|
|
|
wo_mst.update(map, "moveinv_id='" + moveinv_id + "'"); |
|
|
|
invUpLam.eq(StIvtMoveinv::getMoveinv_id, moveinv_id); |
|
|
|
moveinvService.update(invUpLam); |
|
|
|
// 更新移入仓位
|
|
|
|
|
|
|
|
JSONObject jsonAttr = wo_Attr.query("struct_code = '" + point_code2 + "'").uniqueResult(0); |
|
|
|
jsonAttr.put("storagevehicle_code", ""); |
|
|
|
wo_Attr.update(jsonAttr); |
|
|
|
StIvtStructattr attribute = structattrService.getAttributeByCode(point_code2, true); |
|
|
|
attribute.setStoragevehicle_code(""); |
|
|
|
structattrService.updateById(attribute); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void insertDtl(Map map) { |
|
|
|
String bill_type = MapUtil.getStr(map, "bill_type"); |
|
|
|
|
|
|
|
|
|
|
|
public void insertDtl(JSONObject map) { |
|
|
|
if (ObjectUtil.isNotEmpty(map.get("tableData"))) { |
|
|
|
//主表
|
|
|
|
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_MoveInv"); |
|
|
|
ArrayList<Map> rows = (ArrayList<Map>) map.get("tableData"); |
|
|
|
JSONArray arrayTwo = MapUtil.get(map, "tableData", JSONArray.class); |
|
|
|
JSONArray arrayTwo = map.getJSONArray("tableData"); |
|
|
|
map.remove("tableData"); |
|
|
|
String currentUserId = SecurityUtils.getCurrentUserId(); |
|
|
|
String nickName = SecurityUtils.getCurrentNickName(); |
|
|
|
String now = DateUtil.now(); |
|
|
|
String moveinv_id = IdUtil.getSnowflake(1, 1).nextId() + ""; |
|
|
|
String moveinv_id = org.nl.common.utils.IdUtil.getStringId(); |
|
|
|
String bill_code = CodeUtil.getNewCode("MOVE_CODE"); |
|
|
|
String biz_date = (String) map.get("biz_date"); |
|
|
|
biz_date = biz_date.substring(0, 10); |
|
|
@ -189,22 +178,18 @@ public class HandMoveStorServiceImpl implements HandMoveStorService { |
|
|
|
Long deptId = SecurityUtils.getDeptId(); |
|
|
|
map.put("sysdeptid", deptId); |
|
|
|
map.put("syscompanyid", deptId); |
|
|
|
JSONObject jo_mst = JSONObject.parseObject(JSON.toJSONString(map)); |
|
|
|
JSONObject jo_mst = map; |
|
|
|
|
|
|
|
//调用明细处理方法 -- 如果是二期移库则调用 insertDtlByRows2
|
|
|
|
JSONObject ret = new JSONObject(); |
|
|
|
if (jo_mst.getString("stor_id").equals(IOSEnum.STOR_ID.code("二期"))) { |
|
|
|
ret = this.insertDtlByRows2(jo_mst, arrayTwo); |
|
|
|
} |
|
|
|
JSONObject ret = this.insertDtlByRows2(jo_mst, arrayTwo); |
|
|
|
|
|
|
|
map.put("detail_count", ret.getString("detail_count")); |
|
|
|
map.put("total_qty", ret.getString("total_qty")); |
|
|
|
wo_mst.insert(map); |
|
|
|
moveinvService.save(map.toJavaObject(StIvtMoveinv.class)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public JSONObject queryEmp(JSONObject whereJson) { |
|
|
|
whereJson.put("flag", "21"); |
|
|
@ -313,16 +298,6 @@ public class HandMoveStorServiceImpl implements HandMoveStorService { |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
JSONObject insertDtlByRows2(JSONObject jo_mst, JSONArray rows) { |
|
|
|
//明细表
|
|
|
|
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_MoveInvDtl"); |
|
|
|
//主表
|
|
|
|
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_MoveInv"); |
|
|
|
//任务表
|
|
|
|
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task"); |
|
|
|
//点位表
|
|
|
|
WQLObject wo_Point = WQLObject.getWQLObject("SCH_BASE_Point"); |
|
|
|
//载具扩展属性
|
|
|
|
WQLObject extTab = WQLObject.getWQLObject("md_pb_storagevehicleext"); |
|
|
|
//定义返回数据
|
|
|
|
JSONObject ret = new JSONObject(); |
|
|
|
|
|
|
@ -332,42 +307,32 @@ public class HandMoveStorServiceImpl implements HandMoveStorService { |
|
|
|
String nickName = SecurityUtils.getCurrentNickName(); |
|
|
|
String now = DateUtil.now(); |
|
|
|
//定义需要需要插入的库存集合
|
|
|
|
HashMap<String, JSONObject> Struct_map = new HashMap<String, JSONObject>(); |
|
|
|
StringBuffer ids = new StringBuffer(); |
|
|
|
HashMap<String, JSONObject> Struct_map = new HashMap<>(); |
|
|
|
List<String> idList = new ArrayList<>(); |
|
|
|
for (int i = 0; i < rows.size(); i++) { |
|
|
|
JSONObject row = rows.getJSONObject(i); |
|
|
|
String storagevehicle_code = row.getString("storagevehicle_code"); |
|
|
|
if (i == 0) { |
|
|
|
ids.append("'"); |
|
|
|
} |
|
|
|
if (!Struct_map.containsKey(storagevehicle_code)) { |
|
|
|
Struct_map.put(storagevehicle_code, row); |
|
|
|
} |
|
|
|
if (i != 0) { |
|
|
|
ids.append("','"); |
|
|
|
} |
|
|
|
ids.append(storagevehicle_code); |
|
|
|
idList.add(storagevehicle_code); |
|
|
|
} |
|
|
|
ids.append("'"); |
|
|
|
//查询所有载具的库存
|
|
|
|
JSONArray ja = WQL.getWO("QST_IVT_HANDMOVESTOR") |
|
|
|
.addParam("flag", "33") |
|
|
|
.addParam("ids", ids.toString()) |
|
|
|
.process().getResultJSONArray(0); |
|
|
|
JSONArray ja = structattrService.getVehiclesStorage(idList); |
|
|
|
if (ja.size() == 0) { |
|
|
|
throw new BadRequestException("当前所有载具无可移库库存!"); |
|
|
|
} |
|
|
|
double total_qty = 0; |
|
|
|
for (int i = 0; i < ja.size(); i++) { |
|
|
|
JSONObject jo = ja.getJSONObject(i); |
|
|
|
String moveinvdtl_id = IdUtil.getSnowflake(1, 1).nextId() + ""; |
|
|
|
String moveinvdtl_id = org.nl.common.utils.IdUtil.getStringId(); |
|
|
|
total_qty = total_qty + jo.getDoubleValue("qty"); |
|
|
|
jo.put("moveinvdtl_id", moveinvdtl_id); |
|
|
|
jo.put("moveinv_id", jo_mst.getString("moveinv_id")); |
|
|
|
jo.put("seq_no", (i + 1) + ""); |
|
|
|
jo.put("work_status", "01"); |
|
|
|
jo.put("is_issued", "0"); |
|
|
|
JSONObject row = (JSONObject) Struct_map.get(jo.getString("storagevehicle_code")); |
|
|
|
JSONObject row = Struct_map.get(jo.getString("storagevehicle_code")); |
|
|
|
String turnin_struct_id = row.getString("turnin_struct_id"); |
|
|
|
jo.put("turnin_sect_id", row.getString("turnin_sect_id")); |
|
|
|
jo.put("turnin_sect_code", row.getString("turnin_sect_code")); |
|
|
@ -378,30 +343,31 @@ public class HandMoveStorServiceImpl implements HandMoveStorService { |
|
|
|
//查询移入点位 - 如果是二期的就不用查询
|
|
|
|
|
|
|
|
//判断是否已生成过了任务,无未生成则插入任务
|
|
|
|
JSONObject task = wo_Task.query("is_delete = '0' and task_status='04' and point_code1 ='" + jo.getString("turnout_struct_code") + "'").uniqueResult(0); |
|
|
|
if (task != null || "0".equals(is_task)) { |
|
|
|
SchBaseTask entity = taskService.getOne(new LambdaQueryWrapper<SchBaseTask>() |
|
|
|
.eq(SchBaseTask::getIs_delete, "0") |
|
|
|
.eq(SchBaseTask::getTask_status, "04") |
|
|
|
.eq(SchBaseTask::getPoint_code1, jo.getString("turnout_struct_code"))); |
|
|
|
JSONObject task = ObjectUtil.isNotEmpty(entity) ? JSON.parseObject(JSON.toJSONString(entity)) : new JSONObject(); |
|
|
|
if (entity != null || "0".equals(is_task)) { |
|
|
|
jo.put("task_id", task.getString("task_id")); |
|
|
|
} else { |
|
|
|
task = new JSONObject(); |
|
|
|
// 创建任务
|
|
|
|
String task_id = IdUtil.getSnowflake(1, 1).nextId() + ""; |
|
|
|
String task_code = IdUtil.getSnowflake(1, 1).nextId() + ""; |
|
|
|
|
|
|
|
task.put("task_id", task_id); |
|
|
|
task.put("task_code", task_code); |
|
|
|
if(jo_mst.getString("stor_id").equals(IOSEnum.STOR_ID.code("二期"))) { |
|
|
|
task.put("task_type", "010709"); |
|
|
|
} |
|
|
|
// 立库转库任务
|
|
|
|
task.put("task_type", "010709"); |
|
|
|
task.put("acs_task_type", "7"); |
|
|
|
task.put("task_status", TaskStatusEnum.START_AND_POINT.getCode()); |
|
|
|
task.put("point_code1", jo.getString("turnout_struct_code")); |
|
|
|
if(jo_mst.getString("stor_id").equals(IOSEnum.STOR_ID.code("二期"))) { |
|
|
|
task.put("point_code2", row.getString("turnin_struct_code")); |
|
|
|
} |
|
|
|
task.put("point_code2", row.getString("turnin_struct_code")); |
|
|
|
task.put("vehicle_code", jo.getString("storagevehicle_code")); |
|
|
|
// 查询木箱对应载具
|
|
|
|
JSONObject jsonExt = extTab.query("pcsn = '" + jo.getString("storagevehicle_code") + "'").uniqueResult(0); |
|
|
|
JSONObject jsonExt = storagevehicleextService.getOneByPcsnToObject(jo.getString("storagevehicle_code")); |
|
|
|
if (ObjectUtil.isEmpty(jsonExt)) { |
|
|
|
throw new BadRequestException("此木箱对应载具不存在!"+jo.getString("storagevehicle_code")); |
|
|
|
throw new BadRequestException("此木箱对应载具不存在!" + jo.getString("storagevehicle_code")); |
|
|
|
} |
|
|
|
task.put("vehicle_code2", jsonExt.getString("storagevehicle_code")); |
|
|
|
task.put("handle_class", HandMoveStorAcsTask.class.getName()); |
|
|
@ -414,12 +380,11 @@ public class HandMoveStorServiceImpl implements HandMoveStorService { |
|
|
|
task.put("update_optname", nickName); |
|
|
|
task.put("update_time", now); |
|
|
|
task.put("priority", "1"); |
|
|
|
wo_Task.insert(task); |
|
|
|
taskService.save(task.toJavaObject(SchBaseTask.class)); |
|
|
|
jo.put("task_id", task_id); |
|
|
|
} |
|
|
|
//插入明细表
|
|
|
|
wo_dtl.insert(jo); |
|
|
|
|
|
|
|
moveinvdtlService.save(jo.toJavaObject(StIvtMoveinvdtl.class)); |
|
|
|
//更新移出库存
|
|
|
|
jo.put("struct_id", jo.getString("turnout_struct_id")); |
|
|
|
jo.put("change_qty", jo.getDoubleValue("qty")); |
|
|
@ -445,17 +410,12 @@ public class HandMoveStorServiceImpl implements HandMoveStorService { |
|
|
|
from_start.put("taskdtl_type", task.getString("taskdtl_type")); |
|
|
|
from_start.put("taskdtl_id", task.getString("taskdtl_id")); |
|
|
|
from_start.put("task_code", task.getString("task_code")); |
|
|
|
|
|
|
|
if(jo_mst.getString("stor_id").equals(IOSEnum.STOR_ID.code("二期"))) { |
|
|
|
storPublicService.updateStructAndPointTwo(from_start); |
|
|
|
} |
|
|
|
storPublicService.updateStructAndPointTwo(from_start); |
|
|
|
|
|
|
|
//锁定终点点位、仓位
|
|
|
|
from_start.put("struct_id", turnin_struct_id); |
|
|
|
from_start.put("lock_type", "7"); |
|
|
|
if(jo_mst.getString("stor_id").equals(IOSEnum.STOR_ID.code("二期"))) { |
|
|
|
storPublicService.updateStructAndPointTwo(from_start); |
|
|
|
} |
|
|
|
storPublicService.updateStructAndPointTwo(from_start); |
|
|
|
} |
|
|
|
ret.put("total_qty", total_qty); |
|
|
|
ret.put("detail_count", ja.size()); |
|
|
@ -474,40 +434,29 @@ public class HandMoveStorServiceImpl implements HandMoveStorService { |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void update(Map whereJson) { |
|
|
|
//主表
|
|
|
|
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_MoveInv"); |
|
|
|
|
|
|
|
public void update(JSONObject whereJson) { |
|
|
|
String currentUserId = SecurityUtils.getCurrentUserId(); |
|
|
|
String nickName = SecurityUtils.getCurrentNickName(); |
|
|
|
String now = DateUtil.now(); |
|
|
|
String moveinv_id = (String) whereJson.get("moveinv_id"); |
|
|
|
String moveinv_id = whereJson.getString("moveinv_id"); |
|
|
|
//查询主表
|
|
|
|
JSONObject jo_mst = wo_mst.query("moveinv_id='" + moveinv_id + "'").uniqueResult(0); |
|
|
|
|
|
|
|
StIvtMoveinv jo_mst = moveinvService.getById(moveinv_id); |
|
|
|
//调用删除明细,还原库存方法
|
|
|
|
if (jo_mst.getString("stor_id").equals(IOSEnum.STOR_ID.code("二期"))) { |
|
|
|
this.deleteByIdTwo(moveinv_id + ""); |
|
|
|
} |
|
|
|
this.deleteByIdTwo(moveinv_id); |
|
|
|
|
|
|
|
//获取明细
|
|
|
|
ArrayList<Map> rows = (ArrayList<Map>) whereJson.get("tableData"); |
|
|
|
JSONArray arrayTwo = MapUtil.get(whereJson, "tableData", JSONArray.class); |
|
|
|
JSONArray arrayTwo = whereJson.getJSONArray("tableData"); |
|
|
|
|
|
|
|
//调用明细处理方法
|
|
|
|
JSONObject ret ; |
|
|
|
if (jo_mst.getString("stor_id").equals(IOSEnum.STOR_ID.code("二期"))) { |
|
|
|
ret = this.insertDtlByRows2(jo_mst, arrayTwo); |
|
|
|
jo_mst.put("remark", whereJson.get("remark")); |
|
|
|
jo_mst.put("biz_date", whereJson.get("biz_date")); |
|
|
|
jo_mst.put("detail_count", ret.getString("detail_count")); |
|
|
|
jo_mst.put("total_qty", ret.getString("total_qty")); |
|
|
|
jo_mst.put("update_optid", currentUserId + ""); |
|
|
|
jo_mst.put("update_optname", nickName); |
|
|
|
jo_mst.put("update_time", now); |
|
|
|
//更新主表
|
|
|
|
wo_mst.update(jo_mst); |
|
|
|
} |
|
|
|
JSONObject ret = this.insertDtlByRows2((JSONObject) JSON.toJSON(jo_mst), arrayTwo); |
|
|
|
jo_mst.setRemark(whereJson.getString("remark")); |
|
|
|
jo_mst.setBiz_date(whereJson.getString("biz_date")); |
|
|
|
jo_mst.setDetail_count(ret.getString("detail_count")); |
|
|
|
jo_mst.setTotal_qty(ret.getString("total_qty")); |
|
|
|
jo_mst.setUpdate_optid(currentUserId); |
|
|
|
jo_mst.setUpdate_optname(nickName); |
|
|
|
jo_mst.setUpdate_time(now); |
|
|
|
moveinvService.updateById(jo_mst); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -638,7 +587,7 @@ public class HandMoveStorServiceImpl implements HandMoveStorService { |
|
|
|
String[] s = pcsn.split(" "); |
|
|
|
String pcsn_in = String.join("','", Arrays.asList(s)); |
|
|
|
|
|
|
|
map.put("pcsn_in", "('"+pcsn_in+"')"); |
|
|
|
map.put("pcsn_in", "('" + pcsn_in + "')"); |
|
|
|
map.put("pcsn", ""); |
|
|
|
} else { |
|
|
|
map.put("pcsn", "%" + map.get("pcsn") + "%"); |
|
|
@ -656,7 +605,7 @@ public class HandMoveStorServiceImpl implements HandMoveStorService { |
|
|
|
String[] s = sap_pcsn.split(" "); |
|
|
|
String sap_pcsn_in = String.join("','", Arrays.asList(s)); |
|
|
|
|
|
|
|
map.put("sap_pcsn_in", "('"+sap_pcsn_in+"')"); |
|
|
|
map.put("sap_pcsn_in", "('" + sap_pcsn_in + "')"); |
|
|
|
map.put("sap_pcsn", ""); |
|
|
|
} else { |
|
|
|
map.put("sap_pcsn", "%" + map.get("sap_pcsn") + "%"); |
|
|
@ -674,7 +623,7 @@ public class HandMoveStorServiceImpl implements HandMoveStorService { |
|
|
|
String[] s = package_box_sn.split(" "); |
|
|
|
String box_no_in = String.join("','", Arrays.asList(s)); |
|
|
|
|
|
|
|
map.put("package_box_sn_in", "('"+box_no_in+"')"); |
|
|
|
map.put("package_box_sn_in", "('" + box_no_in + "')"); |
|
|
|
map.put("package_box_sn", ""); |
|
|
|
} else { |
|
|
|
map.put("package_box_sn", "%" + map.get("package_box_sn") + "%"); |
|
|
|