代码更新
This commit is contained in:
@@ -12,6 +12,7 @@ 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.wms.sch.manage.RegionTypeEnum;
|
||||
import org.nl.wms.sch.service.PointService;
|
||||
import org.nl.wms.sch.service.dto.PointDto;
|
||||
import org.nl.modules.wql.WQL;
|
||||
@@ -212,10 +213,10 @@ public class PointServiceImpl implements PointService {
|
||||
for (int i = 0; i < arrStruct.size(); i++) {
|
||||
JSONObject json = arrStruct.getJSONObject(i);
|
||||
JSONObject structMap = new JSONObject();
|
||||
structMap.put("point_id", json.getString("struct_id"));
|
||||
structMap.put("point_id", IdUtil.getSnowflake(1,1).nextId());
|
||||
structMap.put("point_code", json.getString("struct_code"));
|
||||
structMap.put("point_name", json.getString("struct_name"));
|
||||
structMap.put("region_id", json.getString("region_id"));
|
||||
structMap.put("region_id", RegionTypeEnum.A_HKZC.getId());
|
||||
structMap.put("source_id", json.getString("struct_id"));
|
||||
structMap.put("point_type", "01");
|
||||
structMap.put("is_host", "0");
|
||||
|
||||
@@ -117,11 +117,9 @@
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
struct.*,region.region_id
|
||||
struct.*
|
||||
FROM
|
||||
ST_IVT_StructAttr struct
|
||||
left join
|
||||
SCH_BASE_Region region on struct.region_id = region.region_id
|
||||
WHERE
|
||||
struct.is_delete = '0'
|
||||
ENDSELECT
|
||||
|
||||
@@ -45,7 +45,7 @@ public interface CheckOutBillService {
|
||||
* {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}]}
|
||||
* /
|
||||
*/
|
||||
void insertDtl (Map whereJson);
|
||||
void insertDtl (JSONObject whereJson);
|
||||
/**
|
||||
* 新增出库单
|
||||
* @param whereJson
|
||||
@@ -82,7 +82,7 @@ public interface CheckOutBillService {
|
||||
* 修改出库单
|
||||
* @param whereJson /
|
||||
*/
|
||||
void update(Map whereJson);
|
||||
void update(JSONObject whereJson);
|
||||
/**
|
||||
* 全部分配,对同一出库单明细进行分配
|
||||
* @param whereJson /
|
||||
|
||||
@@ -431,8 +431,6 @@ public class StorPublicServiceImpl implements StorPublicService {
|
||||
WQLObject wo_Point = WQLObject.getWQLObject("SCH_BASE_Point");
|
||||
//载具表
|
||||
WQLObject wo_Storage = WQLObject.getWQLObject("MD_PB_StorageVehicleInfo");
|
||||
//载具表
|
||||
WQLObject bucketrecord = WQLObject.getWQLObject("md_pb_bucketrecord");
|
||||
String struct_id = from.getString("struct_id");
|
||||
String point_code = from.getString("point_code");
|
||||
//锁定类型
|
||||
@@ -456,13 +454,10 @@ public class StorPublicServiceImpl implements StorPublicService {
|
||||
HashMap<String,String> map = new HashMap<>();
|
||||
if(lock_type.equals("00")){//解锁
|
||||
map.put("lock_type",lock_type);
|
||||
map.put("taskdtl_type","");
|
||||
map.put("taskdtl_id","");
|
||||
map.put("task_code","");
|
||||
map.put("inv_type","");
|
||||
map.put("inv_id","");
|
||||
map.put("inv_code","");
|
||||
String area_type = jo.getString("area_type");
|
||||
//是否清空载具
|
||||
if("1".equals(from.getString("is_free"))){
|
||||
map.put("storagevehicle_code","");
|
||||
@@ -480,35 +475,15 @@ public class StorPublicServiceImpl implements StorPublicService {
|
||||
}
|
||||
map.put("storagevehicle_code",Storage.getString("storagevehicle_code"));
|
||||
map.put("storagevehicle_qty","1");
|
||||
map.put("storagevehicle_type",Storage.getString("storagevehicle_type"));
|
||||
map.put("storagevehicle_id",Storage.getString("storagevehicle_id"));
|
||||
map.put("vehicle_code",Storage.getString("storagevehicle_code"));
|
||||
map.put("point_status","01");
|
||||
JSONArray bus = bucketrecord.query("storagevehicle_code='"+storagevehicle_code+"'").getResultJSONArray(0);
|
||||
if(bus.size()>0){
|
||||
map.put("point_status","02");
|
||||
map.put("is_emptyvehicle","0");
|
||||
}else{
|
||||
map.put("is_emptyvehicle","1");
|
||||
}
|
||||
}else{
|
||||
map.put("is_emptyvehicle","0");
|
||||
if(StrUtil.isNotEmpty(jo.getString("storagevehicle_code"))){
|
||||
String storagevehicle = jo.getString("storagevehicle_code");
|
||||
JSONArray bus = bucketrecord.query("storagevehicle_code='"+storagevehicle+"'").getResultJSONArray(0);
|
||||
if(bus.size()>0){
|
||||
map.put("is_emptyvehicle","0");
|
||||
}else{
|
||||
map.put("is_emptyvehicle","1");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
//区域类型非输送线才需解锁
|
||||
if(!area_type.equals("21")){
|
||||
wo_Point.update(map,"point_id='"+jo.getString("point_id")+"'");
|
||||
wo_Struct.update(map,"struct_id='"+jo.getString("struct_id")+"'");
|
||||
}
|
||||
}else{//锁定
|
||||
map.put("lock_type",lock_type);
|
||||
map.put("taskdtl_type",from.getString("taskdtl_type"));
|
||||
@@ -517,7 +492,6 @@ public class StorPublicServiceImpl implements StorPublicService {
|
||||
map.put("inv_type",from.getString("inv_type"));
|
||||
map.put("inv_id",from.getString("inv_id"));
|
||||
map.put("inv_code",from.getString("inv_code"));
|
||||
String area_type = jo.getString("area_type");
|
||||
if (StrUtil.isNotEmpty(storagevehicle_code)) {
|
||||
JSONObject Storage = wo_Storage.query("storagevehicle_code='"+storagevehicle_code+"'").uniqueResult(0);
|
||||
if(ObjectUtil.isEmpty(Storage)){
|
||||
@@ -529,18 +503,6 @@ public class StorPublicServiceImpl implements StorPublicService {
|
||||
map.put("storagevehicle_id",Storage.getString("storagevehicle_id"));
|
||||
map.put("vehicle_code",Storage.getString("storagevehicle_code"));
|
||||
map.put("point_status","01");
|
||||
JSONArray bus = bucketrecord.query("storagevehicle_code='"+storagevehicle_code+"'").getResultJSONArray(0);
|
||||
if(bus.size()>0){
|
||||
map.put("point_status","02");
|
||||
map.put("is_emptyvehicle","0");
|
||||
}else{
|
||||
map.put("is_emptyvehicle","1");
|
||||
}
|
||||
}
|
||||
//区域类型非输送线才需解锁
|
||||
if(!area_type.equals("21")){
|
||||
wo_Point.update(map,"point_id='"+jo.getString("point_id")+"'");
|
||||
wo_Struct.update(map,"struct_id='"+jo.getString("struct_id")+"'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,6 @@
|
||||
struct.struct_code,
|
||||
point.point_code,
|
||||
point.point_id,
|
||||
point.area_type,
|
||||
struct.storagevehicle_code
|
||||
FROM
|
||||
SCH_BASE_Point point
|
||||
|
||||
@@ -31,24 +31,24 @@ public class CheckOutBillController {
|
||||
}
|
||||
|
||||
@GetMapping("/addDtl")
|
||||
@Log("查询出库单")
|
||||
@ApiOperation("查询出库单")
|
||||
@Log("查询库存")
|
||||
@ApiOperation("查询库存")
|
||||
//@PreAuthorize("@el.check('checkoutbill:list')")
|
||||
public ResponseEntity<Object> queryAddDtl(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(checkOutBillService.queryAddDtl(whereJson,page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/queryDtl")
|
||||
@Log("查询出库单")
|
||||
@ApiOperation("查询出库单")
|
||||
@Log("查询库存")
|
||||
@ApiOperation("查询库存")
|
||||
//@PreAuthorize("@el.check('checkoutbill:list')")
|
||||
public ResponseEntity<Object> queryDtl(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(checkOutBillService.queryDtl(whereJson,page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getOutBillDtl")
|
||||
@Log("查询出库单")
|
||||
@ApiOperation("查询出库单")
|
||||
@Log("查询明细")
|
||||
@ApiOperation("查询明细")
|
||||
public ResponseEntity<Object> getOutBillDtl(@RequestParam Map whereJson){
|
||||
return new ResponseEntity<>(checkOutBillService.getOutBillDtl(whereJson), HttpStatus.OK);
|
||||
}
|
||||
@@ -64,14 +64,14 @@ public class CheckOutBillController {
|
||||
@PutMapping
|
||||
@Log("修改出库单")
|
||||
@ApiOperation("修改出库单")
|
||||
public ResponseEntity<Object> update(@RequestBody Map whereJson){
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson){
|
||||
checkOutBillService.update(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@PostMapping()
|
||||
@Log("新增出库单")
|
||||
@ApiOperation("新增出库单")
|
||||
public ResponseEntity<Object> insertDtl(@RequestBody Map whereJson){
|
||||
public ResponseEntity<Object> insertDtl(@RequestBody JSONObject whereJson){
|
||||
checkOutBillService.insertDtl(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,8 @@ import java.util.*;
|
||||
@Slf4j
|
||||
public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
|
||||
private StorPublicService storPublicService;
|
||||
@Autowired
|
||||
private final StorPublicService storPublicService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> pageQuery(Map whereJson, Pageable page) {
|
||||
@@ -64,12 +65,14 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
public Map<String, Object> queryAddDtl(Map whereJson, Pageable page) {
|
||||
HashMap<String, String> map = new HashMap<>(whereJson);
|
||||
map.put("flag", "7");
|
||||
map.put("begin_time", MapUtil.getStr(whereJson,"begin_time"));
|
||||
map.put("end_time", MapUtil.getStr(whereJson,"end_time"));
|
||||
|
||||
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("remark"))) {
|
||||
map.put("remark", "%" + map.get("remark") + "%");
|
||||
if (StrUtil.isNotEmpty(map.get("pcsn"))) {
|
||||
map.put("pcsn", "%" + map.get("pcsn") + "%");
|
||||
}
|
||||
JSONObject jo = WQL.getWO("QST_IVT_CHECKOUTBILL").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "");
|
||||
return jo;
|
||||
@@ -175,10 +178,10 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void insertDtl(Map map) {
|
||||
public void insertDtl(JSONObject map) {
|
||||
//明细另一种写法
|
||||
//JSONArray jsonArr = JSONArray.fromObject(whereJson.get("tableData"));
|
||||
ArrayList<HashMap> rows = (ArrayList<HashMap>) map.get("tableData");
|
||||
JSONArray rows = map.getJSONArray("tableData");
|
||||
map.remove("tableData");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
@@ -189,6 +192,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
JSONObject jsonStor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("stor_id ='" + MapUtil.getStr(map, "stor_id") + "'").uniqueResult(0);
|
||||
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", "1");
|
||||
@@ -209,13 +213,23 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
map.put("syscompanyid", deptId);
|
||||
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
HashMap<String, String> row = rows.get(i);
|
||||
row.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||
row.put("iostorinv_id", iostorinv_id);
|
||||
row.put("seq_no", (i + 1) + "");
|
||||
row.put("assign_qty", "0");
|
||||
row.put("unassign_qty", row.get("plan_qty"));
|
||||
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(row);
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
jsonDtl.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||
jsonDtl.put("iostorinv_id", iostorinv_id);
|
||||
jsonDtl.put("seq_no", (i + 1) + "");
|
||||
jsonDtl.put("material_id", row.getString("material_id"));
|
||||
jsonDtl.put("pcsn", row.getString("pcsn"));
|
||||
jsonDtl.put("box_no", row.getString("box_no"));
|
||||
jsonDtl.put("quality_scode", "01");
|
||||
jsonDtl.put("bill_status", "10");
|
||||
jsonDtl.put("qty_unit_id", row.get("qty_unit_id"));
|
||||
jsonDtl.put("qty_unit_name", row.getString("qty_unit_name"));
|
||||
jsonDtl.put("plan_qty", row.get("plan_qty"));
|
||||
jsonDtl.put("remark", row.getString("remark"));
|
||||
jsonDtl.put("assign_qty", "0");
|
||||
jsonDtl.put("unassign_qty", row.get("plan_qty"));
|
||||
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(jsonDtl);
|
||||
}
|
||||
WQLObject.getWQLObject("ST_IVT_IOStorInv").insert(map);
|
||||
}
|
||||
@@ -269,7 +283,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(Map whereJson) {
|
||||
public void update(JSONObject whereJson) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
@@ -284,16 +298,25 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
//先删除该单据下的所有明细
|
||||
String iostorinv_id = (String) whereJson.get("iostorinv_id");
|
||||
wo_dtl.delete("iostorinv_id = '" + iostorinv_id + "'");
|
||||
ArrayList<HashMap> rows = (ArrayList<HashMap>) whereJson.get("tableData");
|
||||
JSONArray rows = whereJson.getJSONArray("tableData");
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
HashMap<String, String> row = rows.get(i);
|
||||
row.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||
row.put("iostorinv_id", iostorinv_id);
|
||||
row.put("seq_no", (i + 1) + "");
|
||||
row.put("bill_status", "10");
|
||||
row.put("assign_qty", "0");
|
||||
row.put("unassign_qty", row.get("plan_qty"));
|
||||
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(row);
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
jsonDtl.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||
jsonDtl.put("iostorinv_id", iostorinv_id);
|
||||
jsonDtl.put("seq_no", (i + 1) + "");
|
||||
jsonDtl.put("material_id", row.getString("material_id"));
|
||||
jsonDtl.put("pcsn", row.getString("pcsn"));
|
||||
jsonDtl.put("box_no", row.getString("box_no"));
|
||||
jsonDtl.put("quality_scode", "01");
|
||||
jsonDtl.put("bill_status", "10");
|
||||
jsonDtl.put("qty_unit_id", row.get("qty_unit_id"));
|
||||
jsonDtl.put("qty_unit_name", row.getString("qty_unit_name"));
|
||||
jsonDtl.put("plan_qty", row.get("plan_qty"));
|
||||
jsonDtl.put("remark", row.getString("remark"));
|
||||
jsonDtl.put("assign_qty", "0");
|
||||
jsonDtl.put("unassign_qty", row.get("plan_qty"));
|
||||
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(jsonDtl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -657,12 +680,9 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
.addParam("material_id", map.get("material_id"))
|
||||
.addParam("quality_scode", map.get("quality_scode"))
|
||||
.addParam("pcsn", map.get("pcsn"))
|
||||
.addParam("ivt_level", map.get("ivt_level"))
|
||||
.addParam("is_active", map.get("is_active"))
|
||||
.addParam("iostorinv_id", map.get("iostorinv_id"))
|
||||
.addParam("stor_id", map.get("stor_id"))
|
||||
.addParam("sect_id", map.get("sect_id"))
|
||||
.addParam("remark", map.get("remark"))
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
return jo;
|
||||
|
||||
@@ -67,60 +67,45 @@
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
ios.iostorinv_id AS id,
|
||||
ios.*,
|
||||
user.nick_name AS upload_optname
|
||||
ios.*
|
||||
FROM
|
||||
ST_IVT_IOStorInv ios
|
||||
inner join (SELECT
|
||||
invdtl.iostorinv_id
|
||||
FROM
|
||||
st_ivt_iostorinvdtl invdtl
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = invdtl.material_id
|
||||
where 1=1
|
||||
OPTION 输入.quality_scode <> ""
|
||||
invdtl.quality_scode = 输入.quality_scode
|
||||
ENDOPTION
|
||||
OPTION 输入.pcsn <> ""
|
||||
invdtl.pcsn like 输入.pcsn
|
||||
ENDOPTION
|
||||
OPTION 输入.material_code <> ""
|
||||
(mb.material_code like 输入.material_code or mb.material_name like 输入.material_code)
|
||||
ENDOPTION
|
||||
group by iostorinv_id) dtlcopy on dtlcopy.iostorinv_id = ios.iostorinv_id
|
||||
LEFT JOIN sys_user user ON user.user_id = ios.upload_optid
|
||||
WHERE 1=1
|
||||
WHERE
|
||||
io_type = '1'
|
||||
and ios.is_delete='0'
|
||||
|
||||
OPTION 输入.bill_code <> ""
|
||||
ios.bill_code like 输入.bill_code
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.io_type <> ""
|
||||
ios.io_type = 输入.io_type
|
||||
ENDOPTION
|
||||
OPTION 输入.buss_type <> ""
|
||||
ios.buss_type like 输入.buss_type
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.bill_type <> ""
|
||||
ios.bill_type = 输入.bill_type
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.stor_id <> ""
|
||||
ios.stor_id = 输入.stor_id
|
||||
ENDOPTION
|
||||
OPTION 输入.deptIds <> ""
|
||||
ios.sysdeptid in 输入.deptIds
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.create_mode <> ""
|
||||
ios.create_mode = 输入.create_mode
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.bill_status <> ""
|
||||
ios.bill_status = 输入.bill_status
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.begin_time <> ""
|
||||
ios.input_time >= 输入.begin_time
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.end_time <> ""
|
||||
ios.input_time <= 输入.end_time
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
@@ -168,7 +153,6 @@
|
||||
struct.sect_code,
|
||||
struct.storagevehicle_id,
|
||||
struct.storagevehicle_code,
|
||||
struct.storagevehicle_type,
|
||||
point.point_id
|
||||
FROM
|
||||
ST_IVT_StructIvt ivt
|
||||
@@ -226,7 +210,6 @@
|
||||
struct.sect_code,
|
||||
struct.storagevehicle_id,
|
||||
struct.storagevehicle_code,
|
||||
struct.storagevehicle_type,
|
||||
point.point_id
|
||||
FROM
|
||||
ST_IVT_StructIvt ivt2
|
||||
@@ -305,16 +288,13 @@
|
||||
mb.material_name,
|
||||
task.task_code,
|
||||
task.task_status,
|
||||
task.taskdtl_type,
|
||||
point.point_code AS start_point_code,
|
||||
point2.area_type,
|
||||
point2.source_id
|
||||
task.task_type,
|
||||
point2.point_code
|
||||
FROM
|
||||
ST_IVT_IOStorInvDis dis
|
||||
LEFT JOIN ST_IVT_IOStorInv ios ON ios.iostorinv_id = dis.iostorinv_id
|
||||
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 AND task.is_delete = '0' and task.vehicle_code = dis.storagevehicle_code
|
||||
LEFT JOIN SCH_BASE_Point point ON point.source_id = dis.struct_id
|
||||
LEFT JOIN SCH_BASE_Task task ON task.task_id = dis.task_id
|
||||
LEFT JOIN SCH_BASE_Point point2 ON point2.point_id = dis.point_id
|
||||
WHERE
|
||||
1 = 1
|
||||
@@ -448,41 +428,49 @@
|
||||
IF 输入.flag = "7"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
qldtl.inspectiondtl_id AS source_billdtl_id,
|
||||
qlmst.inspection_type AS source_bill_type,
|
||||
qlmst.inspection_code AS source_bill_code,
|
||||
'QL_TEST_InspectionSheetMst' AS source_bill_table,
|
||||
qldtl.base_bill_code,
|
||||
qldtl.base_bill_id,
|
||||
qldtl.base_bill_table,
|
||||
qldtl.base_bill_type,
|
||||
qlmst.biz_date,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
qldtl.pcsn,
|
||||
'2' AS plan_qty,
|
||||
qldtl.material_id,
|
||||
qldtl.qty_unit_id,
|
||||
qldtl.qty_unit_name
|
||||
ivt.stockrecord_id,
|
||||
ivt.struct_id,
|
||||
ivt.struct_code,
|
||||
ivt.struct_name,
|
||||
ivt.region_id,
|
||||
ivt.material_id,
|
||||
ivt.quality_scode,
|
||||
ivt.pcsn,
|
||||
ivt.canuse_qty,
|
||||
ivt.frozen_qty,
|
||||
ivt.ivt_qty AS plan_qty,
|
||||
ivt.warehousing_qty,
|
||||
ivt.qty_unit_id,
|
||||
ivt.instorage_time,
|
||||
mater.material_name,
|
||||
mater.material_code,
|
||||
unit.unit_name AS qty_unit_name,
|
||||
attr.storagevehicle_code AS box_no
|
||||
FROM
|
||||
ql_test_inspectionsheetdtl qldtl
|
||||
LEFT JOIN ql_test_inspectionsheetmst qlmst ON qlmst.inspection_id = qldtl.inspection_id
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = qldtl.material_id
|
||||
ST_IVT_StructIvt ivt
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = ivt.material_id
|
||||
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = ivt.qty_unit_id
|
||||
LEFT JOIN ST_IVT_StructAttr attr ON attr.struct_id = ivt.struct_id
|
||||
LEFT JOIN PDM_BI_SubPackageRelation sub ON ivt.pcsn = sub.container_name AND sub.status = '2'
|
||||
WHERE
|
||||
qlmst.is_delete = '0'
|
||||
AND qldtl.bill_status IN ('10', '20', '30', '40', '50')
|
||||
AND qlmst.inspection_type IN ('10', '20')
|
||||
OPTION 输入.remark <> ""
|
||||
(mb.material_code like 输入.remark or mb.material_name like 输入.remark)
|
||||
attr.is_delete = '0'
|
||||
AND attr.is_used = '1'
|
||||
|
||||
OPTION 输入.material_code <> ""
|
||||
(mater.material_code like 输入.material_code or
|
||||
mater.material_name like 输入.material_code)
|
||||
ENDOPTION
|
||||
OPTION 输入.bill_code <> ""
|
||||
qlmst.inspection_code like 输入.bill_code
|
||||
|
||||
OPTION 输入.pcsn <> ""
|
||||
ivt.pcsn like 输入.pcsn
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.begin_time <> ""
|
||||
qlmst.biz_date >= 输入.begin_time
|
||||
ivt.instorage_time >= 输入.begin_time
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.end_time <> ""
|
||||
qlmst.biz_date <= 输入.end_time
|
||||
ivt.instorage_time <= 输入.end_time
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
@@ -537,35 +525,21 @@
|
||||
QUERY
|
||||
SELECT
|
||||
dis.*,
|
||||
disdtl.real_qty AS total_storage_qty,
|
||||
disdtl.bucket_num,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
task.start_point_code,
|
||||
task.next_point_code,
|
||||
task.taskdtl_id,
|
||||
task.point_code1 AS start_point_code,
|
||||
task.point_code2 AS next_point_code,
|
||||
task.task_id,
|
||||
task.task_code,
|
||||
task.taskdtl_type,
|
||||
task.task_type,
|
||||
task.task_status
|
||||
FROM
|
||||
st_ivt_iostorinvdis dis
|
||||
LEFT JOIN md_me_materialbase mater ON dis.material_id = mater.material_id
|
||||
LEFT JOIN sch_base_task task ON dis.task_id = task.task_id and task.vehicle_code = dis.storagevehicle_code AND task.is_delete = '0'
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
sum( real_qty ) AS real_qty,
|
||||
count(iostorinvdtl_id) AS bucket_num,
|
||||
iostorinvdtl_id,
|
||||
storagevehicle_id
|
||||
FROM
|
||||
st_ivt_iostorinvdisdtl
|
||||
GROUP BY
|
||||
storagevehicle_id,iostorinvdtl_id
|
||||
) AS disdtl ON dis.iostorinvdtl_id = disdtl.iostorinvdtl_id
|
||||
AND dis.storagevehicle_id = disdtl.storagevehicle_id
|
||||
LEFT JOIN sch_base_task task ON dis.task_id = task.task_id
|
||||
WHERE
|
||||
1=1
|
||||
|
||||
OPTION 输入.iostorinvdtl_id <> ""
|
||||
dis.iostorinvdtl_id = 输入.iostorinvdtl_id
|
||||
ENDOPTION
|
||||
|
||||
Reference in New Issue
Block a user