代码更新

This commit is contained in:
2022-11-19 15:17:02 +08:00
parent 6f16f96020
commit 771c117724
8 changed files with 992 additions and 353 deletions

View File

@@ -10,8 +10,10 @@ 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.system.service.impl.ParamServiceImpl;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
import org.nl.wms.ext.mes.service.MesToLmsService;
import org.nl.wms.log.LokiLog;
@@ -138,6 +140,8 @@ public class MesToLmsServiceImpl implements MesToLmsService {
JSONObject result = new JSONObject();
try {
String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue();
if (StrUtil.equals(is_mesTolms, "1")) {
String ContainerName = param.getString("ContainerName");
String ResourceName = param.getString("ResourceName");
//查询该母卷号、设备号对应的生箔工单
@@ -154,11 +158,11 @@ public class MesToLmsServiceImpl implements MesToLmsService {
json.put("Weight", String.format("%.2f", raw_jo.getDoubleValue("productin_qty")));
json.put("WeighDate", DateUtil.now());
data.add(json);
}
result.put("RTYPE", "S");
result.put("RTMSG", "操作成功!");
result.put("RTOAL", 1);
result.put("RTDAT", data);
result.put("RTDAT", null);
System.out.println(result);
} catch (Exception e) {
@@ -187,6 +191,8 @@ public class MesToLmsServiceImpl implements MesToLmsService {
WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表
try {
String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue();
if (StrUtil.equals(is_mesTolms, "1")) {
String containerName = param.getString("ContainerName");
String resourceName = param.getString("ResourceName");
if (ObjectUtil.isEmpty(resourceName)) throw new BadRequestException("机台编码不能为空");
@@ -211,7 +217,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
JSONObject jsonRaw = rawTab.query("container_name = '" + containerName + "'").uniqueResult(0);
jsonRaw.put("status", "04");
rawTab.update(jsonRaw);
}
result.put("RTYPE", "S");
result.put("RTMSG", "操作成功!");
result.put("RTOAL", 1);
@@ -243,6 +249,8 @@ public class MesToLmsServiceImpl implements MesToLmsService {
JSONObject jsonParam = new JSONObject();
try {
String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue();
if (StrUtil.equals(is_mesTolms, "1")) {
String containerName = param.getString("ContainerName"); // 母卷号
String nextSpec = param.getString("NextSpec"); // 下工序1-入烘箱2-入冷却
String bakingTemperature = param.getString("BakingTemperature"); // 温度
@@ -278,11 +286,6 @@ public class MesToLmsServiceImpl implements MesToLmsService {
// 调用手持接口
BakingServiceImpl bakingService = new BakingServiceImpl();
bakingService.ovenInAndOut(jsonParam);
result.put("RTYPE", "S");
result.put("RTMSG", "操作成功!");
result.put("RTOAL", 1);
result.put("RTDAT", null);
} else {
/*
* 入冷却区
@@ -297,12 +300,12 @@ public class MesToLmsServiceImpl implements MesToLmsService {
// 调用手持接口
BakingServiceImpl bakingService = new BakingServiceImpl();
bakingService.inCoolIvt(jsonParam);
}
}
result.put("RTYPE", "S");
result.put("RTMSG", "操作成功!");
result.put("RTOAL", 1);
result.put("RTDAT", null);
}
} catch (Exception e) {
result.put("RTYPE", "1");
result.put("RTMSG", "操作失败!"+e.getMessage());
@@ -344,7 +347,6 @@ public class MesToLmsServiceImpl implements MesToLmsService {
JSONObject result = new JSONObject();
try {
// 基础校验
if (ObjectUtil.isEmpty(orderType)) throw new BadRequestException("分切订单类型不能为空");
if (ObjectUtil.isEmpty(ContainerName)) throw new BadRequestException("子卷号不能为空");
@@ -452,6 +454,8 @@ public class MesToLmsServiceImpl implements MesToLmsService {
JSONObject result = new JSONObject();
try {
String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue();
if (StrUtil.equals(is_mesTolms, "1")) {
String container_name = param.getString("ContainerName");
if (StrUtil.isEmpty(container_name)) {
throw new BadRequestException("子卷号不能为空!");
@@ -586,7 +590,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
checkOutBillService.allDiv(out_jo);
}
}
result.put("RTYPE", "S");
result.put("RTMSG", "操作成功!");
result.put("RTOAL", 1);
@@ -614,6 +618,8 @@ public class MesToLmsServiceImpl implements MesToLmsService {
public JSONObject childRollCutStartComp(JSONArray param) {
log.info("childRollCutStartComp接口输入参数为-------------------" + param.toString());
String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue();
if (StrUtil.equals(is_mesTolms, "1")) {
String Status = param.getJSONObject(0).getString("Status");
if (Status.equals("1")){
@@ -661,7 +667,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
outService.confirm(jo);
}
}
}
JSONObject result = new JSONObject();
result.put("RTYPE", "S");
result.put("RTMSG", "操作成功!");
@@ -682,6 +688,8 @@ public class MesToLmsServiceImpl implements MesToLmsService {
public JSONObject childRollPackComplete(JSONObject param) {
log.info("childRollPackComplete接口输入参数为-------------------" + param.toString());
String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue();
if (StrUtil.equals(is_mesTolms, "1")) {
String isUnPlanProductionBox = param.getString("isUnPlanProductionBox"); // 生产订单
String QuanlityInBox = param.getString("QuanlityInBox"); // 产品编码
String BoxWeight = param.getString("BoxWeight"); // 产品名称
@@ -745,7 +753,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
WQLObject tab = WQLObject.getWQLObject("PDM_BI_SubPackageRelation");
tab.insert(jo);
}
}
JSONObject result = new JSONObject();
result.put("RTYPE", "S");
result.put("RTMSG", "操作成功!");
@@ -765,6 +773,11 @@ public class MesToLmsServiceImpl implements MesToLmsService {
@Override
public JSONObject inventoryTransferInfoSync(JSONObject param) {
log.info("inventoryTransferInfoSync接口输入参数为-------------------" + param.toString());
String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue();
if (StrUtil.equals(is_mesTolms, "1")) {
}
JSONObject result = new JSONObject();
result.put("RTYPE", "S");
result.put("RTMSG", "操作成功!");
@@ -784,6 +797,12 @@ public class MesToLmsServiceImpl implements MesToLmsService {
@Override
public JSONObject childRollInfoUpdate(JSONObject param) {
log.info("childRollInfoUpdate接口输入参数为-------------------" + param.toString());
String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue();
if (StrUtil.equals(is_mesTolms, "1")) {
}
JSONObject result = new JSONObject();
result.put("RTYPE", "S");
result.put("RTMSG", "操作成功!");

View File

@@ -0,0 +1,78 @@
package org.nl.wms.st.inbill.rest;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.logging.annotation.Log;
import org.nl.wms.st.inbill.service.InchargeService;
import org.nl.wms.st.vehiclebill.service.InEmptyvehiclerecordService;
import org.nl.wms.st.vehiclebill.service.dto.EmptyvehiclerecordDto;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* @author Liuxy
* @date 2022-08-12
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "入库冲销")
@RequestMapping("/api/incharge")
@Slf4j
public class InchargeController {
private final InchargeService inchargeService;
@GetMapping
@Log("查询入库冲销")
@ApiOperation("查询入库冲销")
//@PreAuthorize("@el.check('emptyvehiclerecord:list')")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(inchargeService.queryAll(whereJson, page), HttpStatus.OK);
}
@PostMapping
@Log("新增入库冲销")
@ApiOperation("新增入库冲销")
//@PreAuthorize("@el.check('emptyvehiclerecord:add')")
public ResponseEntity<Object> create(@Validated @RequestBody EmptyvehiclerecordDto dto) {
inchargeService.create(dto);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PutMapping
@Log("修改入库冲销")
@ApiOperation("修改入库冲销")
//@PreAuthorize("@el.check('emptyvehiclerecord:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody EmptyvehiclerecordDto dto) {
inchargeService.update(dto);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("删除入库冲销")
@ApiOperation("删除入库冲销")
//@PreAuthorize("@el.check('emptyvehiclerecord:del')")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
inchargeService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/charge")
@Log("冲销")
@ApiOperation("冲销")
public ResponseEntity<Object> charge(@RequestBody JSONObject whereJson) {
inchargeService.charge(whereJson);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,79 @@
package org.nl.wms.st.inbill.service;
import com.alibaba.fastjson.JSONObject;
import org.nl.wms.st.vehiclebill.service.dto.EmptyvehiclerecordDto;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
* @author Liuxy
* @description 服务接口
* @date 2022-08-12
**/
public interface InchargeService {
/**
* 查询数据分页
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
*/
Map<String, Object> queryAll(Map whereJson, Pageable page);
/**
* 查询所有数据不分页
*
* @param whereJson 条件参数
* @return List<EmptyvehiclerecordDto>
*/
List<EmptyvehiclerecordDto> queryAll(Map whereJson);
/**
* 根据ID查询
*
* @param record_uuid ID
* @return Emptyvehiclerecord
*/
EmptyvehiclerecordDto findById(Long record_uuid);
/**
* 根据编码查询
*
* @param code code
* @return Emptyvehiclerecord
*/
EmptyvehiclerecordDto findByCode(String code);
/**
* 创建
*
* @param dto /
*/
void create(EmptyvehiclerecordDto dto);
/**
* 编辑
*
* @param dto /
*/
void update(EmptyvehiclerecordDto dto);
/**
* 多选删除
*
* @param ids /
*/
void deleteAll(Long[] ids);
/**
* 冲销
*
* @param whereJson /
*/
void charge(JSONObject whereJson);
}

View File

@@ -0,0 +1,307 @@
package org.nl.wms.st.inbill.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
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.system.util.CodeUtil;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.modules.wql.util.WqlUtil;
import org.nl.wms.sch.service.PointService;
import org.nl.wms.st.inbill.service.InchargeService;
import org.nl.wms.st.inbill.service.StorPublicService;
import org.nl.wms.st.vehiclebill.service.InEmptyvehiclerecordService;
import org.nl.wms.st.vehiclebill.service.dto.EmptyvehiclerecordDto;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author Liuxy
* @description 服务实现
* @date 2022-08-12
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class InchargeServiceImpl implements InchargeService {
private final StorPublicService storPublicService;
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
String bill_code = MapUtil.getStr(whereJson, "bill_code");
HashMap<String, String> map = new HashMap<>();
map.put("flag", "1");
map.put("stor_id", MapUtil.getStr(whereJson, "stor_id"));
map.put("begin_time", MapUtil.getStr(whereJson, "begin_time"));
map.put("end_time", MapUtil.getStr(whereJson, "end_time"));
map.put("create_mode", MapUtil.getStr(whereJson, "create_mode"));
map.put("bill_type", MapUtil.getStr(whereJson, "bill_type"));
if (ObjectUtil.isNotEmpty(bill_code)) map.put("bill_code","%"+bill_code + "%");
JSONObject json = WQL.getWO("QST_IVT_INCHARGE").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "ios.input_time DESC");
return json;
}
@Override
public List<EmptyvehiclerecordDto> queryAll(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
JSONArray arr = wo.query().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(EmptyvehiclerecordDto.class);
return null;
}
@Override
public EmptyvehiclerecordDto findById(Long record_uuid) {
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
JSONObject json = wo.query("record_uuid = '" + record_uuid + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)) {
return json.toJavaObject(EmptyvehiclerecordDto.class);
}
return null;
}
@Override
public EmptyvehiclerecordDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)) {
return json.toJavaObject(EmptyvehiclerecordDto.class);
}
return null;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(EmptyvehiclerecordDto dto) {
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
String start_point_code = dto.getStart_point_code();
String next_point_code = dto.getNext_point_code();
// 判断起点是否为空! 入库起点不能为空
if (ObjectUtil.isEmpty(start_point_code)) throw new BadRequestException("起点不能为空");
// 根据点位编码找到对应的所属区域
Long start_region_id = pointTab.query("point_code = '" + start_point_code + "'").uniqueResult(0).getLongValue("region_id");
if (ObjectUtil.isNotEmpty(next_point_code)) {
Long end_region_id = pointTab.query("point_code = '" + next_point_code + "'").uniqueResult(0).getLongValue("region_id");
dto.setEnd_region_id(end_region_id);
}
dto.setRecord_uuid(IdUtil.getSnowflake(1, 1).nextId());
dto.setCreate_id(currentUserId);
dto.setCreate_name(nickName);
dto.setUpdate_optid(currentUserId);
dto.setUpdate_optname(nickName);
dto.setUpdate_time(now);
dto.setCreate_time(now);
dto.setBill_code(CodeUtil.getNewCode("KZJ_BILL_CODE"));
dto.setIo_type("0");
dto.setBill_status("10");
dto.setStart_region_id(start_region_id);
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
wo.insert(json);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(EmptyvehiclerecordDto dto) {
EmptyvehiclerecordDto entity = this.findById(dto.getRecord_uuid());
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
String start_point_code = dto.getStart_point_code();
String next_point_code = dto.getNext_point_code();
// 判断起点是否为空! 入库起点不能为空
if (ObjectUtil.isEmpty(start_point_code)) throw new BadRequestException("起点不能为空");
// 根据点位编码找到对应的所属区域
Long start_region_id = pointTab.query("point_code = '" + start_point_code + "'").uniqueResult(0).getLongValue("region_id");
if (ObjectUtil.isNotEmpty(next_point_code)) {
Long end_region_id = pointTab.query("point_code = '" + next_point_code + "'").uniqueResult(0).getLongValue("region_id");
dto.setEnd_region_id(end_region_id);
}
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
dto.setUpdate_time(now);
dto.setStart_region_id(start_region_id);
dto.setUpdate_optid(currentUserId);
dto.setUpdate_optname(nickName);
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
wo.update(json);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(Long[] ids) {
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
for (Long record_uuid : ids) {
JSONObject param = new JSONObject();
param.put("record_uuid", String.valueOf(record_uuid));
param.put("is_delete", "1");
param.put("update_optid", currentUserId);
param.put("update_optname", nickName);
param.put("update_time", now);
wo.update(param);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void charge(JSONObject whereJson) {
WQLObject mstTab = WQLObject.getWQLObject("ST_IVT_IOStorInv"); // 出入库主表
WQLObject dtlTab = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl"); // 出入库明细表
WQLObject disTab = WQLObject.getWQLObject("ST_IVT_IOStorInvDis"); // 出入库分配表
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_StructIvt"); // 仓位库存表
WQLObject attrTab = WQLObject.getWQLObject("ST_IVT_StructAttr"); // 仓位表
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
Long deptId = SecurityUtils.getDeptId();
String iostorinv_id = whereJson.getString("iostorinv_id");
// 根据入库单创建出库单
JSONObject jsonInMst = mstTab.query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0);
JSONObject jsonOutMst = new JSONObject();
jsonOutMst.put("iostorinv_id", IdUtil.getSnowflake(1,1).nextId());
jsonOutMst.put("bill_code", CodeUtil.getNewCode("IO_CODE"));
jsonOutMst.put("io_type", "1");
jsonOutMst.put("buss_type", "1009");
jsonOutMst.put("bill_type", "1009");
jsonOutMst.put("biz_date", DateUtil.today());
jsonOutMst.put("stor_id", jsonInMst.getLongValue("stor_id"));
jsonOutMst.put("stor_code", jsonInMst.getString("stor_code"));
jsonOutMst.put("stor_name", jsonInMst.getString("stor_name"));
jsonOutMst.put("total_qty", jsonInMst.getDoubleValue("total_qty"));
jsonOutMst.put("total_weight", jsonInMst.getDoubleValue("total_weight"));
jsonOutMst.put("detail_count", jsonInMst.getIntValue("detail_count"));
jsonOutMst.put("bill_status", "40");
jsonOutMst.put("input_optid", currentUserId);
jsonOutMst.put("input_optname", nickName);
jsonOutMst.put("input_time", DateUtil.now());
jsonOutMst.put("update_optid", currentUserId);
jsonOutMst.put("update_optname", nickName);
jsonOutMst.put("update_time", DateUtil.now());
jsonOutMst.put("dis_optid", currentUserId);
jsonOutMst.put("dis_optname", nickName);
jsonOutMst.put("dis_time", DateUtil.now());
jsonOutMst.put("sysdeptid", deptId);
jsonOutMst.put("syscompanyid", deptId);
mstTab.insert(jsonOutMst);
// 根据入库明细生成出库明细
JSONArray inDtlArr = dtlTab.query("iostorinv_id = '" + iostorinv_id + "'").getResultJSONArray(0);
for (int i = 0; i < inDtlArr.size(); i++) {
JSONObject json = inDtlArr.getJSONObject(i);
JSONObject jsonOutDtl = new JSONObject();
jsonOutDtl.put("iostorinvdtl_id", IdUtil.getSnowflake(1,1).nextId());
jsonOutDtl.put("iostorinv_id", jsonOutMst.getLongValue("iostorinv_id"));
jsonOutDtl.put("seq_no", json.getIntValue("seq_no"));
jsonOutDtl.put("material_id", json.getLongValue("material_id"));
jsonOutDtl.put("pcsn", json.getString("pcsn"));
jsonOutDtl.put("box_no", json.getString("box_no"));
jsonOutDtl.put("quality_scode", "01");
jsonOutDtl.put("bill_status", "40");
jsonOutDtl.put("qty_unit_id", json.getLongValue("qty_unit_id"));
jsonOutDtl.put("qty_unit_name", json.getString("qty_unit_name"));
jsonOutDtl.put("plan_qty", json.getDoubleValue("plan_qty"));
jsonOutDtl.put("source_billdtl_id", json.getLongValue("iostorinvdtl_id"));
// jsonOutDtl.put("source_bill_code", jsonInMst.getString("bill_code"));
jsonOutDtl.put("assign_qty", json.getDoubleValue("assign_qty"));
jsonOutDtl.put("unassign_qty", json.getDoubleValue("unassign_qty"));
jsonOutDtl.put("vbeln", json.getString("vbeln"));
jsonOutDtl.put("posnr", json.getString("posnr"));
dtlTab.insert(jsonOutDtl);
// 根据入库分配明细生成出库分配明细
JSONArray inDisArr = disTab.query("iostorinvdtl_id = '" + json.getString("iostorinvdtl_id") + "'").getResultJSONArray(0);
for (int j = 0; j < inDisArr.size(); j++) {
JSONObject json2 = inDisArr.getJSONObject(j);
JSONObject jsonOutDis = new JSONObject();
jsonOutDis.put("iostorinvdis_id", IdUtil.getSnowflake(1,1).nextId());
jsonOutDis.put("iostorinv_id", jsonOutMst.getLongValue("iostorinv_id"));
jsonOutDis.put("iostorinvdtl_id", jsonOutDtl.getLongValue("iostorinvdtl_id"));
jsonOutDis.put("seq_no", json2.getIntValue("seq_no"));
jsonOutDis.put("sect_id", json2.getLongValue("sect_id"));
jsonOutDis.put("sect_code", json2.getString("sect_code"));
jsonOutDis.put("sect_name", json2.getString("sect_name"));
jsonOutDis.put("struct_id", json2.getLongValue("struct_id"));
jsonOutDis.put("struct_code", json2.getString("struct_code"));
jsonOutDis.put("struct_name", json2.getString("struct_name"));
jsonOutDis.put("material_id", json2.getLongValue("material_id"));
jsonOutDis.put("pcsn", json2.getString("pcsn"));
jsonOutDis.put("box_no", json2.getString("box_no"));
jsonOutDis.put("quality_scode", "01");
// 如果是虚拟库区则将执行状态改为生成01
if (StrUtil.equals(jsonOutDis.getString("sect_code"), "XN01")) {
jsonOutDis.put("work_status", "01");
} else {
jsonOutDis.put("work_status", "00");
}
jsonOutDis.put("qty_unit_id", json2.getLongValue("qty_unit_id"));
jsonOutDis.put("qty_unit_name", json2.getString("qty_unit_name"));
jsonOutDis.put("plan_qty", json2.getDoubleValue("plan_qty"));
jsonOutDis.put("real_qty", json2.getDoubleValue("real_qty"));
disTab.insert(jsonOutDis);
//更新库存
JSONObject jsonIvt = ivtTab.query("pcsn = '" + jsonOutDis.getString("pcsn") + "' and canuse_qty <> '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonIvt)) throw new BadRequestException("库存不存在");
jsonIvt.put("bill_type_scode", jsonOutMst.getString("bill_type"));
jsonIvt.put("inv_id", jsonOutMst.getString("iostorinv_id"));
jsonIvt.put("bill_code", jsonOutMst.getString("bill_code"));
jsonIvt.put("bill_table", "ST_IVT_IOStorInv");
jsonIvt.put("change_qty", json2.getDoubleValue("real_qty"));
storPublicService.IOStor(jsonIvt, "11");
// 锁定仓位
JSONObject jsonAttr = attrTab.query("struct_id = '" + jsonIvt.getString("struct_id") + "'").uniqueResult(0);
jsonAttr.put("lock_type", "3");
attrTab.update(jsonAttr);
}
}
// 修改入库单 是否冲销为 是
jsonInMst.put("is_writeoff", "1");
jsonInMst.put("writeoff_optid", currentUserId);
jsonInMst.put("writeoff_time", DateUtil.now());
mstTab.update(jsonInMst);
}
}

View File

@@ -0,0 +1,86 @@
[交易说明]
交易名: 入库冲销分页查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.begin_time TYPEAS s_string
输入.end_time TYPEAS s_string
输入.bill_code TYPEAS s_string
输入.stor_id TYPEAS s_string
输入.create_mode TYPEAS s_string
输入.bill_type TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
ios.*
FROM
ST_IVT_IOStorInv ios
WHERE
ios.is_delete = '0'
AND ios.io_type = '0'
AND ios.bill_status = '99'
AND ios.is_writeoff = '0'
AND ios.bill_type = '0002'
OPTION 输入.bill_code <> ""
ios.bill_code like 输入.bill_code
ENDOPTION
OPTION 输入.stor_id <> ""
ios.stor_id = 输入.stor_id
ENDOPTION
OPTION 输入.bill_type <> ""
ios.bill_type = 输入.bill_type
ENDOPTION
OPTION 输入.create_mode <> ""
ios.create_mode = 输入.create_mode
ENDOPTION
OPTION 输入.begin_time <> ""
ios.input_time >= 输入.begin_time
ENDOPTION
OPTION 输入.end_time <> ""
ios.input_time <= 输入.end_time
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF

View File

@@ -1732,6 +1732,72 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
// 调用接口回传
new LmsToMesServiceImpl().childRollFGOutboundComplete(paramMesMst);
}
// 手工出库
if (StrUtil.equals(bill_type, "1009")) {
// 1.回传sap
JSONArray paramSapMstArr = new JSONArray();
JSONObject paramSapMst = new JSONObject();
paramSapMst.put("ZACTION", "R");
paramSapMst.put("BUDAT", jo_mst.getString("biz_date"));
paramSapMst.put("ZZYGYF", jo_mst.getString("estimated_freight"));
paramSapMst.put("ZZYFGY", jo_mst.getString("trans_code"));
String vbeln = "";
JSONArray paramDtlArr = new JSONArray();
JSONArray dtlArr = wo_dtl.query("iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").getResultJSONArray(0);
for (int i = 0; i < dtlArr.size(); i++) {
JSONArray paramDisArr = new JSONArray();
JSONObject json = dtlArr.getJSONObject(i);
JSONObject jsonMater = materTab.query("material_id = '" + json.getString("material_id") + "'").uniqueResult(0);
vbeln = json.getString("vbeln");
// 明细
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")); // 明細储存地点
}
JSONObject jsonSub = subTab.query("container_name = '" + json2.getString("pcsn") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonSub)) {
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);
if (ObjectUtil.isNotEmpty(vbeln)) {
// 调用接口回传
new LmsToSapServiceImpl().returnDelivery(param);
}
}
// 改切出库
if (StrUtil.equals(bill_type, "1003")) {

View File

@@ -24,4 +24,12 @@ export function edit(data) {
})
}
export default { add, edit, del }
export function charge(data) {
return request({
url: 'api/incharge/charge',
method: 'post',
data
})
}
export default { add, edit, del, charge }

View File

@@ -67,24 +67,6 @@
</el-select>
</el-form-item>
<el-form-item label="单据状态">
<el-select
v-model="query.bill_status"
clearable
size="mini"
placeholder="单据状态"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in dict.io_bill_status"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="业务类型">
<el-select
v-model="query.bill_type"
@@ -96,7 +78,7 @@
@change="crud.toQuery"
>
<el-option
v-for="item in dict.ST_INV_OUT_TYPE"
v-for="item in dict.ST_INV_IN_TYPE"
:key="item.value"
:label="item.label"
:value="item.value"
@@ -111,13 +93,13 @@
<el-button
slot="right"
class="filter-item"
type="warning"
:disabled="dis_flag"
type="success"
:disabled="crud.selections.length !== 1"
icon="el-icon-check"
size="mini"
@click="backConfirm"
@click="charge"
>
强制确认
冲销
</el-button>
</crudOperation>
<!--表格渲染-->
@@ -130,8 +112,9 @@
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="selection" width="55" />
<el-table-column show-overflow-tooltip prop="bill_code" width="130" label="单据编码" />
<el-table-column show-overflow-tooltip :formatter="stateFormat" width="100" prop="bill_status" label="单据状态" />
<el-table-column show-overflow-tooltip :formatter="formatStatus" width="100" prop="bill_status" label="单据状态" />
<el-table-column prop="stor_name" label="仓库" width="100" />
<el-table-column show-overflow-tooltip prop="bill_type" :formatter="bill_typeFormat" label="业务类型" />
<el-table-column show-overflow-tooltip width="135" prop="biz_date" label="业务日期" />
@@ -175,9 +158,9 @@ export default {
sort: 'id,desc',
crudMethod: { ...crudInchargefrom },
optShow: {
add: true,
edit: true,
del: true,
add: false,
edit: false,
del: false,
download: false,
reset: false
}
@@ -185,15 +168,12 @@ export default {
},
mixins: [presenter(), header(), crud()],
// 数据字典
dicts: ['ST_CREATE_MODE', 'ST_INV_OUT_TYPE'],
dicts: ['ST_CREATE_MODE', 'ST_INV_IN_TYPE', 'io_bill_status'],
data() {
return {
permission: {
},
billType: null,
storlist: [],
createtypelist: [],
statuslist: []
storlist: []
}
},
created() {
@@ -204,6 +184,22 @@ export default {
methods: {
[CRUD.HOOK.beforeRefresh]() {
return true
},
charge() {
const _selectData = this.$refs.table.selection
crudInchargefrom.charge(_selectData[0]).then(res => {
this.crud.notify('操作完成!', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
})
},
formatStatus(row) {
return this.dict.label.io_bill_status[row.bill_status]
},
bill_typeFormat(row) {
return this.dict.label.ST_INV_IN_TYPE[row.bill_type]
},
create_modeFormat(row) {
return this.dict.label.ST_CREATE_MODE[row.create_mode]
}
}
}