add:新增需求
This commit is contained in:
@@ -28,6 +28,12 @@
|
||||
输入.bill_code TYPEAS s_string
|
||||
输入.return_code TYPEAS s_string
|
||||
输入.no_ids TYPEAS f_string
|
||||
输入.material_code TYPEAS s_string
|
||||
输入.contract_no TYPEAS s_string
|
||||
输入.supp_name TYPEAS s_string
|
||||
输入.iszero TYPEAS s_string
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -194,6 +200,47 @@
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
IF 输入.flag = "88"
|
||||
QUERY
|
||||
SELECT
|
||||
pp.*
|
||||
FROM
|
||||
PURCHASE_CONTRACT_VIEW pp
|
||||
WHERE
|
||||
pp.STATUSFLAG = '1'
|
||||
OPTION 输入.begin_time <> ""
|
||||
pp.SUBSCRIBEDATE >= 输入.begin_time
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.end_time <> ""
|
||||
pp.SUBSCRIBEDATE <= 输入.end_time
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.material_code <> ""
|
||||
pp.ITEM_CODE like 输入.material_code
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.contract_no <> ""
|
||||
pp.VBILLCODE like 输入.contract_no
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.supp_name <> ""
|
||||
pp.NAME like 输入.supp_name
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.iszero = "true"
|
||||
pp.QTY_ZT = '0'
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.iszero = "false"
|
||||
pp.QTY_ZT <> '0'
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "9"
|
||||
QUERY
|
||||
SELECT
|
||||
|
||||
@@ -39,12 +39,27 @@ public class HandPFOutIvtController {
|
||||
return new ResponseEntity<>(handPFOutIvtService.scanPoint(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/scanpoint2")
|
||||
@Log("原材料直接出库手持查询")
|
||||
@ApiOperation("原材料直接出库手持查询")
|
||||
public ResponseEntity<Object> scanpoint2(@RequestBody Map<String, String> whereJson) {
|
||||
return new ResponseEntity<>(handPFOutIvtService.scanpoint2(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/confirmoutstore")
|
||||
@Log("出库确认")
|
||||
@ApiOperation("出库确认")
|
||||
public ResponseEntity<Object> confirmOutStore(@RequestBody Map<String, String> whereJson) {
|
||||
return new ResponseEntity<>(handPFOutIvtService.confirmOutStore(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/confirmoutstore2")
|
||||
@Log("原材料直接出库出库确认")
|
||||
@ApiOperation("原材料直接出库出库确认")
|
||||
public ResponseEntity<Object> confirmoutstore2(@RequestBody Map<String, String> whereJson) {
|
||||
return new ResponseEntity<>(handPFOutIvtService.confirmoutstore2(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/backstore")
|
||||
@Log("回库")
|
||||
@ApiOperation("回库")
|
||||
|
||||
@@ -11,6 +11,8 @@ public interface HandPFOutIvtService {
|
||||
*/
|
||||
Map<String, Object> scanPoint(Map<String, String> jsonObject);
|
||||
|
||||
Map<String, Object> scanpoint2(Map<String, String> jsonObject);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param jsonObject
|
||||
@@ -24,6 +26,8 @@ public interface HandPFOutIvtService {
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> confirmOutStore(Map<String, String> jsonObject);
|
||||
Map<String, Object> confirmoutstore2(Map<String, String> whereJson);
|
||||
|
||||
Map<String, Object> confirmOutStore2(Map<String, String> jsonObject);
|
||||
/**
|
||||
* 手持通过托盘查询桶信息
|
||||
@@ -34,6 +38,4 @@ public interface HandPFOutIvtService {
|
||||
Map<String, Object> backStore(Map<String, String> jsonObject);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -95,6 +95,49 @@ public class HandPFOutIvtServiceImpl implements HandPFOutIvtService {
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> scanpoint2(Map<String, String> jsonObject) {
|
||||
JSONObject returnjo = new JSONObject();
|
||||
String storagevehicle_code = jsonObject.get("storagevehicle_code");
|
||||
String point_code = jsonObject.get("point_code");
|
||||
// 仓位属性表【ST_IVT_StructAttr】
|
||||
WQLObject structAttr_table = WQLObject.getWQLObject("ST_IVT_StructAttr");
|
||||
// 点位基础表【SCH_BASE_Point】
|
||||
WQLObject point_table = WQLObject.getWQLObject("SCH_BASE_Point");
|
||||
//仓位库存表【ST_IVT_StructIvt】
|
||||
WQLObject ivt_table = WQLObject.getWQLObject("ST_IVT_StructIvt");
|
||||
// 桶记录表【MD_PB_BucketRecord】
|
||||
WQLObject bucket_table = WQLObject.getWQLObject("MD_PB_BucketRecord");
|
||||
|
||||
if (StrUtil.isEmpty(storagevehicle_code)) {
|
||||
throw new PdaRequestException("载具不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(point_code)) {
|
||||
throw new PdaRequestException("点位不能为空!");
|
||||
}
|
||||
//1、根据输入托盘号,点位号,查询【仓位属性表】,是否存在载具,并且仓位未锁定,查询【点位基础表】 ,是否存在载具,并且仓位未锁定,不满足提示错误
|
||||
JSONObject attrrow = structAttr_table.query("storagevehicle_code='" + storagevehicle_code + "' and lock_type='00'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(attrrow)) {
|
||||
throw new PdaRequestException("仓位属性表没有该载具,或者改载具的点位是锁定状态!");
|
||||
}
|
||||
|
||||
JSONObject pointrow = point_table.query("vehicle_code='" + storagevehicle_code + "' and lock_type='00'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(pointrow)) {
|
||||
throw new PdaRequestException("点位表没有该载具,或者改载具的点位是锁定状态!");
|
||||
}
|
||||
JSONObject pointObj = structAttr_table.query("struct_code='" + point_code + "'").uniqueResult(0);
|
||||
JSONObject ivtjo = ivt_table.query("struct_id='" + pointObj.getString("struct_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(ivtjo)) {
|
||||
throw new PdaRequestException("仓位为【'" + point_code + "'】没有库存信息!");
|
||||
}
|
||||
//3、 通过托盘,查询【桶记录表】状态=入库,得到载具桶库存信息,无结果提示错误;
|
||||
JSONArray bucketrow = WQL.getWO("QPADST_OUT_SERVICE").addParam("flag", "2").addParam("storagevehicle_code", storagevehicle_code).process().getResultJSONArray(0);
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "查询成功");
|
||||
returnjo.put("result", bucketrow);
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Map<String, Object> queryStoragevehicle(Map<String, String> jsonObject) {
|
||||
@@ -421,6 +464,299 @@ public class HandPFOutIvtServiceImpl implements HandPFOutIvtService {
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> confirmoutstore2(Map<String, String> jsonObject) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
UserDto userDto = userService.findById(currentUserId);
|
||||
// 仓位属性表【ST_IVT_StructAttr】
|
||||
WQLObject structAttr_table = WQLObject.getWQLObject("ST_IVT_StructAttr");
|
||||
// 点位基础表【SCH_BASE_Point】
|
||||
WQLObject point_table = WQLObject.getWQLObject("SCH_BASE_Point");
|
||||
//仓位库存表【ST_IVT_StructIvt】
|
||||
WQLObject ivt_table = WQLObject.getWQLObject("ST_IVT_StructIvt");
|
||||
// 桶记录表【MD_PB_BucketRecord】
|
||||
WQLObject bucket_table = WQLObject.getWQLObject("MD_PB_BucketRecord");
|
||||
//库区属性表【ST_IVT_SectAttr】
|
||||
|
||||
WQLObject inv_table = WQLObject.getWQLObject("ST_IVT_IOStorInv");
|
||||
// 出入库单明细表【ST_IVT_IOStorInvDtl】
|
||||
WQLObject invdtl_table = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl");
|
||||
//出入库单分配表【ST_IVT_IOStorInvDis】
|
||||
WQLObject invdis_table = WQLObject.getWQLObject("ST_IVT_IOStorInvDis");
|
||||
// 出入库单分配明细表【ST_IVT_IOStorInvDisDtl】
|
||||
WQLObject invdisdtl_table = WQLObject.getWQLObject("ST_IVT_IOStorInvDisDtl");
|
||||
//仓位库存变动记录表【ST_IVT_StructIvtFlow】
|
||||
WQLObject ivtflow_table = WQLObject.getWQLObject("ST_IVT_StructIvtFlow");
|
||||
// 桶物料变动记录表【MD_PB_BucketChangeFlow】
|
||||
WQLObject bucketchange_table = WQLObject.getWQLObject("MD_PB_BucketChangeFlow");
|
||||
String point_code = jsonObject.get("point_code");
|
||||
String storagevehicle_code = jsonObject.get("storagevehicle_code");
|
||||
// 手工出库
|
||||
String bill_type= "010601";
|
||||
|
||||
JSONObject vehicleObj = WQLObject.getWQLObject("MD_PB_StorageVehicleInfo").query("storagevehicle_code='" + storagevehicle_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(vehicleObj)) {
|
||||
throw new PdaRequestException("载具号为【'" + storagevehicle_code + "'】未找到!");
|
||||
}
|
||||
JSONObject pointObj = WQLObject.getWQLObject("sch_base_point").query("point_code='" + point_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(pointObj)) {
|
||||
throw new PdaRequestException("站点为未找到!请输入正确的站点");
|
||||
}
|
||||
String area_type = pointObj.getString("area_type");
|
||||
String bucketunique = jsonObject.get("bucketunique");
|
||||
String out_qty = NumberUtil.round(jsonObject.get("out_qty"), 3).toString();
|
||||
//根据桶查询物料批次信息
|
||||
JSONObject bucketObj = WQLObject.getWQLObject("md_pb_bucketrecord").query("bucketunique='" + bucketunique + "'").uniqueResult(0);
|
||||
String material_id = bucketObj.getString("material_id");
|
||||
String pcsn = bucketObj.getString("pcsn");
|
||||
String quality_scode = bucketObj.getString("quality_scode");
|
||||
String ivt_level = bucketObj.getString("ivt_level");
|
||||
String is_active = bucketObj.getString("is_active");
|
||||
//根据物料查询计量单位
|
||||
if (StrUtil.isEmpty(material_id)) {
|
||||
throw new PdaRequestException("物料标识不能为空!");
|
||||
}
|
||||
|
||||
boolean is_yl = this.materialbaseService.isAlongMaterType(MaterOptTypeEnum.YL.getCode(), material_id, (String)null);
|
||||
boolean is_fl = this.materialbaseService.isAlongMaterType(MaterOptTypeEnum.FL.getCode(), material_id, (String)null);
|
||||
|
||||
if (is_fl || is_yl) {
|
||||
if (!StrUtil.equals(quality_scode,"01")){
|
||||
throw new PdaRequestException("原辅料品质类型必须为合格!");
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject materialObj = WQL.getWO("QPADST_OUT_SERVICE").addParam("flag", "3").process().uniqueResult(0);
|
||||
String qty_unit_id = materialObj.getString("base_unit_id");
|
||||
String qty_unit_name = materialObj.getString("unit_name");
|
||||
|
||||
|
||||
//判断【仓位属性表】和【点位基础表】,点位、托盘,记录是否存在,不存在提示错误;
|
||||
if (StrUtil.isEmpty(storagevehicle_code)) {
|
||||
throw new PdaRequestException("托盘编码不能为空!");
|
||||
}
|
||||
JSONObject attrrow = structAttr_table.query("storagevehicle_code='" + storagevehicle_code + "' and lock_type='00'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(attrrow)) {
|
||||
throw new PdaRequestException("仓位属性表没有该载具,或者改载具的点位是锁定状态!");
|
||||
}
|
||||
|
||||
JSONObject pointrow = point_table.query("vehicle_code='" + storagevehicle_code + "' and lock_type='00'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(pointrow)) {
|
||||
throw new PdaRequestException("点位表没有该载具,或者改载具的点位是锁定状态!");
|
||||
}
|
||||
|
||||
//3、查询【仓位库存表】,判断仓位、物料批次、品质类型、库存等级、是否可用的库存是否存在,不存在提示错误,同时判断库存可用量是否满足出库重量,不满足提示错误;
|
||||
String struct_id = attrrow.getString("struct_id");
|
||||
JSONObject ivtjo = ivt_table.query("struct_id='" + struct_id + "' and material_id='" + material_id + "' and quality_scode='" + quality_scode + "' and pcsn ='" + pcsn + "' and ivt_level='" + ivt_level + "' and is_active='"+is_active+"'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(ivtjo)) {
|
||||
throw new PdaRequestException("该物料的库存信息找不到!");
|
||||
}
|
||||
String canuse_qty = ivtjo.getString("canuse_qty");
|
||||
BigDecimal canuse_qty_bigDecimal = new BigDecimal(null == canuse_qty ? "0" : canuse_qty).setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal out_qty_bigDecimal = new BigDecimal(null == out_qty ? "0" : out_qty).setScale(3, RoundingMode.HALF_UP);
|
||||
if (NumberUtil.sub(canuse_qty_bigDecimal,out_qty_bigDecimal).doubleValue() < 0) {
|
||||
throw new PdaRequestException("库存的可用数量小于出库数量!");
|
||||
}
|
||||
//4、 查询【桶记录表】,判断桶号、物料批次、品质类型、库存等级、是否可用的库存是否存在,不存在提示错误,同时判断库存可用量是否满足出库重量,不满足提示错误;
|
||||
JSONObject bucketjo = bucket_table.query("bucketunique='" + bucketunique + "' and material_id ='" + material_id + "' and quality_scode ='" + quality_scode + "' and pcsn ='" + pcsn + "' and ivt_level='" + ivt_level + "' and is_active='"+is_active+"'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(bucketjo)) {
|
||||
throw new PdaRequestException("该物料的桶信息查询不到!");
|
||||
}
|
||||
double bucketflag = NumberUtil.round(bucketjo.getDouble("storage_qty")-Double.valueOf(out_qty),3).doubleValue();
|
||||
|
||||
if (bucketflag < 0) {
|
||||
throw new PdaRequestException("桶记录的数量小于出库数量!");
|
||||
}
|
||||
//插入主表,明细表,分配表,分配明细表
|
||||
JSONObject invrow = new JSONObject();
|
||||
JSONObject invdtl = new JSONObject();
|
||||
JSONObject disjo = new JSONObject();
|
||||
JSONObject disdtljo = new JSONObject();
|
||||
String now = DateUtil.now();
|
||||
String today = DateUtil.today();
|
||||
String iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
String iostorinvdtl_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
String iostorinvdis_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
String iostorinvdisdtl_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
String bill_code = CodeUtil.getNewCode("IO_CODE");
|
||||
|
||||
//默认为 生产配粉出库 010301
|
||||
invrow.put("iostorinv_id", iostorinv_id);
|
||||
invrow.put("bill_code", bill_code);
|
||||
invrow.put("bill_type", bill_type);
|
||||
invrow.put("buss_type", "0106");
|
||||
invrow.put("stor_id", attrrow.getString("stor_id"));
|
||||
invrow.put("stor_name", attrrow.getString("stor_name"));
|
||||
invrow.put("stor_code", attrrow.getString("stor_code"));
|
||||
invrow.put("io_type", "1");
|
||||
invrow.put("biz_date", today);
|
||||
invrow.put("total_qty", out_qty);
|
||||
invrow.put("detail_count", 1);
|
||||
invrow.put("bill_status", "99");
|
||||
invrow.put("create_mode", "02");
|
||||
invrow.put("input_optid", currentUserId);
|
||||
invrow.put("input_optname", userDto.getNickName());
|
||||
invrow.put("input_time", now);
|
||||
invrow.put("update_optid", currentUserId);
|
||||
invrow.put("update_optname", userDto.getNickName());
|
||||
invrow.put("update_time", now);
|
||||
invrow.put("dis_optid", currentUserId);
|
||||
invrow.put("dis_optname", userDto.getNickName());
|
||||
invrow.put("dis_time", now);
|
||||
invrow.put("confirm_optid", currentUserId);
|
||||
invrow.put("confirm_optname", userDto.getNickName());
|
||||
invrow.put("confirm_time", now);
|
||||
invrow.put("sysdeptid", userDto.getDept().getId());
|
||||
invrow.put("syscompanyid", userDto.getDept().getId());
|
||||
invrow.put("is_delete", "0");
|
||||
invrow.put("is_upload", "0");
|
||||
//明细
|
||||
|
||||
invdtl.put("iostorinvdtl_id", iostorinvdtl_id);
|
||||
invdtl.put("iostorinv_id", iostorinv_id);
|
||||
invdtl.put("seq_no", "1");
|
||||
invdtl.put("material_id", material_id);
|
||||
invdtl.put("pcsn", pcsn);
|
||||
invdtl.put("quality_scode", quality_scode);
|
||||
invdtl.put("ivt_level", ivt_level);
|
||||
invdtl.put("is_active", is_active);
|
||||
invdtl.put("qty_unit_id", qty_unit_id);
|
||||
invdtl.put("bill_status", "99");
|
||||
invdtl.put("qty_unit_name", qty_unit_name);
|
||||
invdtl.put("plan_qty", out_qty);
|
||||
invdtl.put("real_qty", out_qty);
|
||||
invdtl.put("assign_qty", out_qty);
|
||||
invdtl.put("unassign_qty", "0");
|
||||
//分配
|
||||
disjo.put("iostorinvdis_id", iostorinvdis_id);
|
||||
disjo.put("iostorinvdtl_id", iostorinvdtl_id);
|
||||
disjo.put("iostorinv_id", iostorinv_id);
|
||||
disjo.put("seq_no", "1");
|
||||
disjo.put("sect_id", attrrow.getString("sect_id"));
|
||||
disjo.put("sect_code", attrrow.getString("sect_code"));
|
||||
disjo.put("sect_name", attrrow.getString("sect_name"));
|
||||
disjo.put("struct_id", attrrow.getString("struct_id"));
|
||||
disjo.put("struct_code", attrrow.getString("struct_code"));
|
||||
disjo.put("struct_name", attrrow.getString("struct_name"));
|
||||
disjo.put("material_id", material_id);
|
||||
disjo.put("pcsn", pcsn);
|
||||
disjo.put("quality_scode", quality_scode);
|
||||
disjo.put("ivt_level", ivt_level);
|
||||
disjo.put("is_active", is_active);
|
||||
|
||||
disjo.put("storagevehicle_id", vehicleObj.getString("storagevehicle_id"));
|
||||
disjo.put("storagevehicle_code", vehicleObj.getString("storagevehicle_code"));
|
||||
disjo.put("storagevehicle_type", vehicleObj.getString("storagevehicle_type"));
|
||||
disjo.put("qty_unit_id", qty_unit_id);
|
||||
disjo.put("plan_qty", out_qty);
|
||||
disjo.put("real_qty", out_qty);
|
||||
disjo.put("qty_unit_name", qty_unit_name);
|
||||
disjo.put("point_id", pointrow.getString("point_id"));
|
||||
disjo.put("point_code", pointrow.getString("point_code"));
|
||||
disjo.put("point_name", pointrow.getString("point_name"));
|
||||
disjo.put("work_status", "99");
|
||||
//插入分配明细
|
||||
|
||||
disdtljo.put("iostorinvdisdtl_id", iostorinvdisdtl_id);
|
||||
disdtljo.put("iostorinvdis_id", iostorinvdis_id);
|
||||
disdtljo.put("iostorinv_id", iostorinv_id);
|
||||
disdtljo.put("iostorinvdtl_id", iostorinvdtl_id);
|
||||
disdtljo.put("seq_no", "1");
|
||||
disdtljo.put("sect_code", attrrow.getString("sect_code"));
|
||||
disdtljo.put("sect_id", attrrow.getString("sect_id"));
|
||||
disdtljo.put("sect_name", attrrow.getString("sect_name"));
|
||||
disdtljo.put("struct_id", attrrow.getString("struct_id"));
|
||||
disdtljo.put("struct_code", attrrow.getString("struct_code"));
|
||||
disdtljo.put("struct_name", attrrow.getString("struct_name"));
|
||||
disdtljo.put("material_id", material_id);
|
||||
disdtljo.put("ivt_level", ivt_level);
|
||||
disdtljo.put("pcsn", pcsn);
|
||||
disdtljo.put("quality_scode", quality_scode);
|
||||
disdtljo.put("is_active", is_active);
|
||||
disdtljo.put("storagevehicle_id", vehicleObj.getString("storagevehicle_id"));
|
||||
disdtljo.put("storagevehicle_code", vehicleObj.getString("storagevehicle_code"));
|
||||
disdtljo.put("storagevehicle_type", vehicleObj.getString("storagevehicle_type"));
|
||||
disdtljo.put("bucketunique", bucketunique);
|
||||
disdtljo.put("qty_unit_id", qty_unit_id);
|
||||
disdtljo.put("qty_unit_name", qty_unit_name);
|
||||
disdtljo.put("real_qty", out_qty);
|
||||
inv_table.insert(invrow);
|
||||
invdtl_table.insert(invdtl);
|
||||
invdis_table.insert(disjo);
|
||||
invdisdtl_table.insert(disdtljo);
|
||||
|
||||
//当对抑制剂、碳粉、钨粉等不需要配粉移库的物料进行扫桶出库后,更新【配粉间桶记录表】桶数量,假如不是整桶出,则不用管
|
||||
JSONObject ProducMaterialExtObj = WQLObject.getWQLObject("MD_ME_ProducMaterialExt").query("material_id='" + material_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(ProducMaterialExtObj) && bill_type.equals("010501")) {
|
||||
String is_need_move = ProducMaterialExtObj.getString("is_need_move");
|
||||
if (StrUtil.equals(is_need_move, "1") && bucketflag == 0) ;
|
||||
if (StrUtil.equals(area_type, "22") || StrUtil.equals(area_type, "23") || StrUtil.equals(area_type, "24")) {
|
||||
bucketjo.put("area_type", area_type);
|
||||
bucketjo.put("create_time", DateUtil.now());
|
||||
WQLObject.getWQLObject("PDM_BI_FormulaBucketRecord").insert(bucketjo);
|
||||
}
|
||||
}
|
||||
//更新桶记录表
|
||||
//数量相同待变出完
|
||||
String status = bucketjo.getString("status");
|
||||
bucketjo.put("storage_qty", bucketflag);
|
||||
bucketjo.put("outstor_optid", "");
|
||||
bucketjo.put("outstor_optname", "");
|
||||
bucketjo.put("outstor_time", now);
|
||||
//出完状态为出库
|
||||
if (bucketflag == 0) {
|
||||
status = "04";
|
||||
bucketjo.put("storagevehicle_id", "");
|
||||
bucketjo.put("storagevehicle_code", "");
|
||||
}
|
||||
bucketjo.put("status", status);
|
||||
bucket_table.update(bucketjo);
|
||||
|
||||
//插入【桶物料变动记录表】
|
||||
JSONObject changeObj = new JSONObject();
|
||||
changeObj.put("change_id", IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||
changeObj.put("bucket_code", bucketunique);
|
||||
changeObj.put("material_id", material_id);
|
||||
changeObj.put("pcsn", pcsn);
|
||||
changeObj.put("ivt_level", ivt_level);
|
||||
changeObj.put("is_active", is_active);
|
||||
changeObj.put("quality_scode", quality_scode);
|
||||
changeObj.put("change_type_scode", "02");
|
||||
changeObj.put("change_time", now);
|
||||
changeObj.put("rec_person", "werwerew");
|
||||
changeObj.put("change_qty", out_qty);
|
||||
changeObj.put("result_qty", bucketflag);
|
||||
changeObj.put("qty_unit_id", qty_unit_id);
|
||||
changeObj.put("qty_unit_name", qty_unit_name);
|
||||
bucketchange_table.update(changeObj);
|
||||
JSONObject form = new JSONObject();
|
||||
|
||||
form.put("struct_id", struct_id);
|
||||
form.put("material_id", material_id);
|
||||
form.put("quality_scode", quality_scode);
|
||||
form.put("pcsn", pcsn);
|
||||
form.put("ivt_level", ivt_level);
|
||||
form.put("is_active", is_active);
|
||||
form.put("change_qty", out_qty);
|
||||
form.put("bill_type_scode", bill_type);
|
||||
form.put("inv_id", iostorinv_id);
|
||||
form.put("bill_code", bill_code);
|
||||
form.put("qty_unit_id", qty_unit_id);
|
||||
form.put("qty_unit_name", qty_unit_name);
|
||||
|
||||
//同时减
|
||||
storPublicService.IOStor(form, "25");
|
||||
//解锁起点
|
||||
JSONObject from_start = new JSONObject();
|
||||
from_start.put("struct_id", attrrow.getString("struct_id"));
|
||||
from_start.put("lock_type", "00");
|
||||
storPublicService.updateStructAndPoint(from_start);
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "出库确认成功!");
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> confirmOutStore2(Map<String, String> jsonObject) {
|
||||
String input_optid = MapUtil.getStr(jsonObject, "input_optid");
|
||||
|
||||
@@ -105,7 +105,7 @@ public class PcsIfPurchaseorderprocController {
|
||||
@Log("合同台账查询")
|
||||
@ApiOperation("合同台账查询")
|
||||
public ResponseEntity<Object> ledgerQuery(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(pcsIfPurchaseorderprocService.ledgerQuery(whereJson,page),HttpStatus.OK);
|
||||
return new ResponseEntity<>(pcsIfPurchaseorderprocService.ledgerQuery22(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/saveRemark")
|
||||
|
||||
@@ -85,6 +85,14 @@ public interface PcsIfPurchaseorderprocService {
|
||||
*/
|
||||
Map<String,Object> ledgerQuery(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> ledgerQuery22(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
|
||||
@@ -5,6 +5,7 @@ package org.nl.wms.pcs.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.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
@@ -348,10 +349,132 @@ public class PcsIfPurchaseorderprocServiceImpl implements PcsIfPurchaseorderproc
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> ledgerQuery22(Map whereJson, Pageable page) {
|
||||
// 供应商表
|
||||
WQLObject suppTab = WQLObject.getWQLObject("md_cs_supplierbase");
|
||||
// 采购订单接口处理表
|
||||
WQLObject procTab = WQLObject.getWQLObject("pcs_if_purchaseorderproc");
|
||||
|
||||
String material_code = MapUtil.getStr(whereJson, "material_code");
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "88");
|
||||
map.put("begin_time", MapUtil.getStr(whereJson, "begin_time"));
|
||||
map.put("end_time", MapUtil.getStr(whereJson, "end_time"));
|
||||
map.put("iszero", MapUtil.getStr(whereJson, "iszero"));
|
||||
|
||||
if (!ObjectUtil.isEmpty(material_code)) {
|
||||
//处理转义字符
|
||||
if (material_code.contains("\\")) {
|
||||
material_code = material_code.replace("\\", "\\\\\\");
|
||||
}
|
||||
map.put("material_code", "%" + material_code + "%");
|
||||
}
|
||||
String contract_no = MapUtil.getStr(whereJson, "contract_no");
|
||||
String supp_name = MapUtil.getStr(whereJson, "supp_name");
|
||||
if (!ObjectUtil.isEmpty(contract_no)) {
|
||||
map.put("contract_no", "%" + contract_no + "%");
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(supp_name)) {
|
||||
map.put("supp_name", "%" + supp_name + "%");
|
||||
}
|
||||
|
||||
// 查询erp合同信息
|
||||
List<JSONObject> erpList = WQL.getWO("QERP").setDbname("dataSource1").addParamMap(map).process().getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
// 查询所有供应商
|
||||
List<JSONObject> suppList = suppTab.query("is_used = '1' and is_delete = '0'")
|
||||
.getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
// 根据合同编码找所有采购订单
|
||||
String vbillcode_in = erpList.stream()
|
||||
.map(row -> row.getString("vbillcode"))
|
||||
.collect(Collectors.joining("','"));
|
||||
List<JSONObject> procList = procTab.query("contract_no IN ('" + vbillcode_in + "') AND dr = '0'")
|
||||
.getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
// 根据采购订单id查询所有有效的到货通知单明细
|
||||
String proc_id_in = procList.stream()
|
||||
.map(row -> row.getString("id"))
|
||||
.collect(Collectors.joining("','"));
|
||||
List<JSONObject> dtlList = WQL.getWO("QPCS_IF_PURCHASEORDERPROC02").addParam("flag", "14").addParam("proc_id", "('" + proc_id_in + "')")
|
||||
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
|
||||
// 处理erp返回数据
|
||||
List<JSONObject> resultList = new ArrayList<>();
|
||||
for (JSONObject erp : erpList) {
|
||||
// 签订时间
|
||||
erp.put("subscribedate", erp.getString("subscribedate"));
|
||||
// 合同编码
|
||||
erp.put("contract_no", erp.getString("vbillcode"));
|
||||
// 供应商
|
||||
erp.put("supp_name", erp.getString("name"));
|
||||
// 物料编码
|
||||
erp.put("material_code", erp.getString("item_code"));
|
||||
// 物料名称
|
||||
erp.put("material_name", erp.getString("item_name"));
|
||||
// 单价含税
|
||||
erp.put("price_tax", erp.getString("norigtaxprice"));
|
||||
// 合同重量
|
||||
erp.put("qty_ht", erp.getString("qty_ht"));
|
||||
// 合同金额
|
||||
erp.put("norigtaxmny", erp.getString("norigtaxmny"));
|
||||
// 未到货重量
|
||||
erp.put("qty_zt", erp.getString("qty_zt"));
|
||||
// 处理状态: 合同未到货重量 = 0则为【完成】;合同未到货重量 <> 0则为【采购中】
|
||||
erp.put("proc_status", erp.getString("qty_zt").equals("0") ? "完成" : "采购中");
|
||||
|
||||
// 账龄:取供应商【honour_days】字段
|
||||
JSONObject jsonSupp = suppList.stream()
|
||||
.filter(row -> row.getString("ext_id").equals(erp.getString("cvendorid")))
|
||||
.findFirst().orElse(null);
|
||||
if (ObjectUtil.isEmpty(jsonSupp)) {
|
||||
throw new BadRequestException("外部标志为【"+erp.getString("cvendorid")+"】的供应商不存在或未启用!");
|
||||
}
|
||||
erp.put("honour_days", jsonSupp.getString("honour_days"));
|
||||
|
||||
// 合计重量:1.根据此【合同编码】和【物料编码】找采购订单 2.根据采购订单【标识】找到所有到货通知单明细数量的和
|
||||
String procId_contains = procList.stream()
|
||||
.filter(row -> row.getString("contract_no").equals(erp.getString("vbillcode"))
|
||||
&& row.getString("item_id").equals(erp.getString("item_id"))
|
||||
)
|
||||
.map(row -> row.getString("id"))
|
||||
.collect(Collectors.joining("','"));
|
||||
double allqty = dtlList.stream()
|
||||
.filter(row -> procId_contains.contains(row.getString("source_billdtl_id")))
|
||||
.map(row -> row.getDoubleValue("receive_qty"))
|
||||
.reduce(Double::sum).orElse(0.00);
|
||||
// 合计金额:合计重量 * 含税单价
|
||||
erp.put("allqty", allqty);
|
||||
erp.put("all_valmoney", NumberUtil.div(allqty, erp.getDoubleValue("norigtaxprice")));
|
||||
resultList.add(erp);
|
||||
}
|
||||
|
||||
// 根据签订时间排序(倒序)
|
||||
resultList = resultList.stream()
|
||||
.sorted(Comparator.comparing(row -> row.getString("subscribedate"),Comparator.reverseOrder()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 组织分页查询并返回
|
||||
Map<String, Object> json = PageUtil.toPage(
|
||||
PageUtil.toPage(page.getPageNumber(), page.getPageSize(), resultList),
|
||||
resultList.size()
|
||||
);
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> receiveQuery(Map whereJson, Pageable page) {
|
||||
String id = MapUtil.getStr(whereJson, "id");
|
||||
JSONObject json = WQL.getWO("QPCS_IF_PURCHASEORDERPROC02").addParam("source_billdtl_id", id).addParam("flag", "2").pageQuery(WqlUtil.getHttpContext(page), "mst.receive_date desc");
|
||||
// 采购订单接口处理表
|
||||
WQLObject procTab = WQLObject.getWQLObject("pcs_if_purchaseorderproc");
|
||||
|
||||
String contract_no = MapUtil.getStr(whereJson, "contract_no");
|
||||
String item_id = MapUtil.getStr(whereJson, "item_id");
|
||||
// 根据物料id和合同编码查询所有采购订单
|
||||
List<JSONObject> procList = procTab.query("ITEM_ID = '" + item_id + "' and contract_no = '" + contract_no + "' and DR = '0'")
|
||||
.getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
String procId_in = procList.stream()
|
||||
.map(row -> row.getString("id"))
|
||||
.collect(Collectors.joining("','"));
|
||||
|
||||
JSONObject json = WQL.getWO("QPCS_IF_PURCHASEORDERPROC02").addParam("source_billdtl_id", "('"+procId_in+"')").addParam("flag", "2").pageQuery(WqlUtil.getHttpContext(page), "mst.receive_date desc");
|
||||
return json;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,10 +21,11 @@
|
||||
输入.proc_status TYPEAS s_string
|
||||
输入.contract_no TYPEAS s_string
|
||||
输入.supp_name TYPEAS s_string
|
||||
输入.source_billdtl_id TYPEAS s_string
|
||||
输入.source_billdtl_id TYPEAS f_string
|
||||
输入.classIds TYPEAS f_string
|
||||
输入.vbillcodes TYPEAS f_string
|
||||
输入.iszero TYPEAS f_string
|
||||
输入.proc_id TYPEAS f_string
|
||||
|
||||
|
||||
[临时表]
|
||||
@@ -230,7 +231,7 @@
|
||||
LEFT JOIN PCS_RC_ReceiveMst mst ON dtl.receive_id = mst.receive_id
|
||||
LEFT JOIN md_cs_supplierbase supp ON oder.VEND_ID = supp.ext_id
|
||||
WHERE
|
||||
dtl.source_billdtl_id = 输入.source_billdtl_id
|
||||
dtl.source_billdtl_id in 输入.source_billdtl_id
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
@@ -320,3 +321,21 @@
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "14"
|
||||
QUERY
|
||||
SELECT
|
||||
dtl.*
|
||||
FROM
|
||||
pcs_rc_receivedtl dtl
|
||||
LEFT JOIN pcs_rc_receivemst mst ON mst.receive_id = dtl.receive_id
|
||||
WHERE
|
||||
mst.is_delete = '0'
|
||||
|
||||
OPTION 输入.proc_id <> ""
|
||||
dtl.source_billdtl_id in 输入.proc_id
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ export default {
|
||||
default: false
|
||||
},
|
||||
openParam: {
|
||||
type: String
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -98,7 +98,8 @@ export default {
|
||||
this.$emit('update:dialogShow', false)
|
||||
},
|
||||
open() {
|
||||
this.crud.query.id = this.openParam
|
||||
this.crud.query.contract_no = this.openParam.contract_no
|
||||
this.crud.query.item_id = this.openParam.item_id
|
||||
this.crud.toQuery()
|
||||
},
|
||||
formatStatusName(row, column) {
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
<el-table-column label="合同内容" align="center">
|
||||
<el-table-column prop="subscribedate" label="签订时间" width="150px" show-overflow-tooltip />
|
||||
<el-table-column prop="contract_no" label="合同编码" width="120px" show-overflow-tooltip/>
|
||||
<el-table-column prop="proc_status" label="处理状态" width="120px" :formatter="formaterStatus" show-overflow-tooltip/>
|
||||
<el-table-column prop="proc_status" label="处理状态" width="120px" show-overflow-tooltip/>
|
||||
<el-table-column prop="supp_name" label="供应商" min-width="220" show-overflow-tooltip/>
|
||||
<el-table-column prop="material_code" label="物料编码" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column prop="material_name" label="物料名称" min-width="150" show-overflow-tooltip />
|
||||
@@ -194,7 +194,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
procStatusList: [],
|
||||
openParam: '',
|
||||
openParam: null,
|
||||
receiveDialog: false,
|
||||
remarkDaing: false
|
||||
}
|
||||
@@ -220,7 +220,7 @@ export default {
|
||||
}
|
||||
},
|
||||
openReceive(index, row) {
|
||||
this.openParam = row.id
|
||||
this.openParam = row
|
||||
this.receiveDialog = true
|
||||
},
|
||||
openRemarkDaing(row) {
|
||||
|
||||
Reference in New Issue
Block a user