add:手工排产功能上线;出库单设置
This commit is contained in:
@@ -65,6 +65,11 @@ public class PdmProduceWorkorderController{
|
||||
public ResponseEntity<Object> query(WorkorderQuery query, PageQuery page) {
|
||||
return new ResponseEntity<>(iPdmProduceWorkorderService.queryAll(query, page), HttpStatus.OK);
|
||||
}
|
||||
@GetMapping("/queryByAps")
|
||||
@Log("查询工单管理")
|
||||
public ResponseEntity<Object> queryByAps(WorkorderQuery query, PageQuery page) {
|
||||
return new ResponseEntity<>(iPdmProduceWorkorderService.queryAllByAps(query, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("查询工单管理")
|
||||
|
||||
@@ -41,6 +41,7 @@ public interface IPdmProduceWorkorderService extends IService<PdmProduceWorkorde
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
TableDataInfo queryAll(WorkorderQuery whereJson, PageQuery page);
|
||||
TableDataInfo queryAllByAps(WorkorderQuery whereJson, PageQuery page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
|
||||
@@ -25,6 +25,8 @@ import java.util.Map;
|
||||
public interface PdmProduceWorkorderMapper extends BaseMapper<PdmProduceWorkorder>{
|
||||
List<Map> pageQuery(@Param("query") WorkorderQuery query);
|
||||
|
||||
List<Map> pageQueryByAps(@Param("query") WorkorderQuery query);
|
||||
|
||||
List<Map> getworkOrderDtl(String workorder_id);
|
||||
|
||||
int batchUpdateByParam(@Param("event") List<Map> event, @Param("workorder_id") String workorder_id);
|
||||
|
||||
@@ -3,6 +3,91 @@
|
||||
<mapper namespace="org.nl.wms.product_manage.service.workorder.dao.mapper.PdmProduceWorkorderMapper">
|
||||
|
||||
<select id="pageQuery" resultType="java.util.Map">
|
||||
SELECT
|
||||
DATE_FORMAT(ShiftOrder.planproducestart_date, '%Y-%m-%d %H:%i:%s' ) AS planproducestart_date,
|
||||
DATE_FORMAT(ShiftOrder.planproduceend_date, '%Y-%m-%d %H:%i:%s' ) AS planproduceend_date,
|
||||
DATE_FORMAT(ShiftOrder.realproducestart_date, '%Y-%m-%d %H:%i:%s' ) AS realproducestart_date,
|
||||
DATE_FORMAT(ShiftOrder.realproduceend_date, '%Y-%m-%d %H:%i:%s' ) AS realproduceend_date,
|
||||
ShiftOrder.*,
|
||||
material.material_name,
|
||||
material.material_code,
|
||||
material.material_spec,
|
||||
material.net_weight AS material_weight,
|
||||
IF(material.limit_qty=0,device.outupperlimit_qty,material.limit_qty) as outupperlimit_qty,
|
||||
pro.workprocedure_code,
|
||||
pro.workprocedure_name,
|
||||
users.person_name AS current_produce_person_name
|
||||
FROM PDM_produce_workOrder ShiftOrder
|
||||
LEFT JOIN md_me_materialbase material ON material.material_id = ShiftOrder.material_id
|
||||
LEFT JOIN PDM_BI_WorkProcedure pro ON pro.workprocedure_id = ShiftOrder.workprocedure_id
|
||||
LEFT JOIN sys_user users ON users.user_id = ShiftOrder.current_produce_person_id
|
||||
LEFT JOIN pdm_bi_device device ON ShiftOrder.device_code = device.device_code
|
||||
WHERE
|
||||
ShiftOrder.device_code is not null and ShiftOrder.current_produce_person_id is not null and
|
||||
ShiftOrder.is_delete = '0' AND ShiftOrder.aps_work_type != 'S'
|
||||
<if test="query.workorder_code != null and query.workorder_code != ''">
|
||||
and ShiftOrder.workorder_code like concat('%',#{query.workorder_code},'%')
|
||||
</if>
|
||||
<if test="query.filter_order_code == null or query.filter_order_code == ''">
|
||||
and ShiftOrder.workorder_code !=0 and ShiftOrder.device_code IS NOT NULL
|
||||
</if>
|
||||
<if test="query.order_status != null and query.order_status != ''">
|
||||
and find_in_set(ShiftOrder.workorder_status, #{query.order_status})
|
||||
</if>
|
||||
<if test="query.device_code != null and query.device_code != ''">
|
||||
and ShiftOrder.device_code like '%${query.device_code}%'
|
||||
</if>
|
||||
<if test="query.create_type != null and query.create_type != ''">
|
||||
and ShiftOrder.create_type = #{query.create_type}
|
||||
</if>
|
||||
<if test="query.shift_type_scode != null and query.shift_type_scode != ''">
|
||||
and ShiftOrder.shift_type_scode = #{query.shift_type_scode}
|
||||
</if>
|
||||
<if test="query.workprocedure_id != null and query.workprocedure_id != ''">
|
||||
and pro.workprocedure_id = #{query.workprocedure_id}
|
||||
</if>
|
||||
<if test="query.workprocedure_code != null and query.workprocedure_code != ''">
|
||||
and pro.workprocedure_code = #{query.workprocedure_code}
|
||||
</if>
|
||||
<if test="query.workprocedure_codes != null and query.workprocedure_codes != ''">
|
||||
and pro.workprocedure_code IN #{query.workprocedure_codes}
|
||||
</if>
|
||||
<if test="query.product_area != null and query.product_area != ''">
|
||||
and ShiftOrder.product_area = #{query.product_area}
|
||||
</if>
|
||||
<if test="query.is_error != null and query.is_error != ''">
|
||||
and ShiftOrder.is_error = #{query.is_error}
|
||||
</if>
|
||||
<if test="query.product_series != null and query.product_series != ''">
|
||||
and ShiftOrder.materialprocess_series in ${query.product_series}
|
||||
</if>
|
||||
<if test="query.start_time != null and query.start_time != ''">
|
||||
and ShiftOrder.realproducestart_date >= #{query.start_time}
|
||||
</if>
|
||||
<if test="query.end_time != null and query.end_time != ''">
|
||||
and ShiftOrder.realproduceend_date <= #{query.end_time}
|
||||
</if>
|
||||
<if test="query.plan_start_time != null and query.plan_start_time != ''">
|
||||
and ShiftOrder.planproducestart_date >= #{query.plan_start_time}
|
||||
</if>
|
||||
<if test="query.plan_end_time != null and query.plan_end_time != ''">
|
||||
and ShiftOrder.planproducestart_date <= #{query.plan_end_time}
|
||||
</if>
|
||||
<if test="query.sale_id != null and query.sale_id != ''">
|
||||
and ShiftOrder.sale_id like '%${query.sale_id}%'
|
||||
</if>
|
||||
<if test="query.material_code != null and query.material_code != ''">
|
||||
and material.material_code = #{query.material_code}
|
||||
</if>
|
||||
<if test="query.material != null and query.material != ''">
|
||||
and (
|
||||
material.material_code like '%${query.material}%' or
|
||||
material.material_name like '%${query.material}%' or
|
||||
material.material_spec like '%${query.material}%'
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
<select id="pageQueryByAps" resultType="java.util.Map">
|
||||
SELECT
|
||||
DATE_FORMAT(ShiftOrder.planproducestart_date, '%Y-%m-%d %H:%i:%s' ) AS planproducestart_date,
|
||||
DATE_FORMAT(ShiftOrder.planproduceend_date, '%Y-%m-%d %H:%i:%s' ) AS planproduceend_date,
|
||||
|
||||
@@ -120,7 +120,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
|
||||
@Override
|
||||
public TableDataInfo queryAll(WorkorderQuery query, PageQuery pageQuery) {
|
||||
String orderBy = "ShiftOrder.workorder_code";
|
||||
String orderBy = "ShiftOrder.workorder_status desc,ShiftOrder.device_code desc,ShiftOrder.aps_workorder_no asc";
|
||||
if (!StringUtils.isEmpty(query.getProduct_series())) {
|
||||
String collect = classstandardService.getChildIdStr(query.getProduct_series()).stream().collect(Collectors.joining("','"));
|
||||
query.setProduct_series("('" + collect + "')");
|
||||
@@ -128,9 +128,6 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
if (!StringUtils.isEmpty(query.getOrder_status()) && query.getOrder_status().contains("-1")) {
|
||||
query.setOrder_status(query.getOrder_status().replaceAll("-1", "1,2,3,4"));
|
||||
}
|
||||
if (!StringUtils.isEmpty(query.getFilter_order_code())) {
|
||||
orderBy = "ShiftOrder.aps_workorder_no desc";
|
||||
}
|
||||
if (!StringUtils.isEmpty(query.getTitleSort())) {
|
||||
orderBy = query.getTitleSort();
|
||||
}
|
||||
@@ -141,6 +138,28 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
return build;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TableDataInfo queryAllByAps(WorkorderQuery query, PageQuery pageQuery) {
|
||||
String orderBy = "ShiftOrder.workprocedure_id asc,ShiftOrder.aps_workorder_no asc,ShiftOrder.workorder_code desc";
|
||||
if (!StringUtils.isEmpty(query.getProduct_series())) {
|
||||
String collect = classstandardService.getChildIdStr(query.getProduct_series()).stream().collect(Collectors.joining("','"));
|
||||
query.setProduct_series("('" + collect + "')");
|
||||
}
|
||||
if (!StringUtils.isEmpty(query.getOrder_status()) && query.getOrder_status().contains("-1")) {
|
||||
query.setOrder_status(query.getOrder_status().replaceAll("-1", "1,2,3,4"));
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(query.getTitleSort())) {
|
||||
orderBy = query.getTitleSort();
|
||||
}
|
||||
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize()).setOrderBy(orderBy);
|
||||
List<Map> result = pdmProduceWorkorderMapper.pageQueryByAps(query);
|
||||
TableDataInfo build = TableDataInfo.build(result);
|
||||
build.setTotalElements(page.getTotal());
|
||||
return build;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object queryAll(Map whereJson) {
|
||||
return this.list();
|
||||
@@ -582,7 +601,10 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
}
|
||||
if(j == 4) {
|
||||
//设备 A1_TW_
|
||||
workorder.setDevice_code("A1_TW_" + col.replaceAll("-", "_"));
|
||||
String s = col.replaceAll("-", "_");
|
||||
if (StringUtils.isNotEmpty(s)){
|
||||
workorder.setDevice_code("A1_TW_" + s);
|
||||
}
|
||||
}
|
||||
if(j == 7) {
|
||||
//单重
|
||||
@@ -618,7 +640,8 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
PdmProduceWorkorder workorder = data.get(i);
|
||||
SysUser sysUser = users.get(workorder.getCurrent_produce_person_id());
|
||||
if(sysUser == null) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "账号:" + workorder.getCurrent_produce_person_id() + "不存在");
|
||||
//errorMap.put("第" + (i + 1) + "行:", "账号:" + workorder.getCurrent_produce_person_id() + "不存在");
|
||||
workorder.setCurrent_produce_person_id(null);
|
||||
}
|
||||
else{
|
||||
workorder.setCurrent_produce_person_id(sysUser.getUser_id());
|
||||
@@ -744,7 +767,8 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
PdmProduceWorkorder workorder = data.get(i);
|
||||
SysUser sysUser = users.get(workorder.getCurrent_produce_person_id());
|
||||
if(sysUser == null) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "账号:" + workorder.getCurrent_produce_person_id() + "不存在");
|
||||
//errorMap.put("第" + (i + 1) + "行:", "账号:" + workorder.getCurrent_produce_person_id() + "不存在");
|
||||
workorder.setCurrent_produce_person_id(null);
|
||||
}
|
||||
else{
|
||||
workorder.setCurrent_produce_person_id(sysUser.getUser_id());
|
||||
@@ -785,26 +809,30 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
for(int i = 0; i < data.size(); i++) {
|
||||
PdmProduceWorkorder item = data.get(i);
|
||||
List<PdmBiDevice> devices = listMap.get(item.getWorkprocedure_id());
|
||||
if("1535144356586165920".equals(item.getWorkprocedure_id())) {
|
||||
item.setDevice_code("A1_DC_" + item.getDevice_code().replaceAll("-", "_"));
|
||||
}
|
||||
else if("1535143882327724032".equals(item.getWorkprocedure_id())) {
|
||||
item.setDevice_code("A1_XY_" + item.getDevice_code().replaceAll("-", "_"));
|
||||
}
|
||||
else{
|
||||
List<PdmBiDevice> deviceCollect = devices.stream().filter(pdmBiDevice ->
|
||||
{
|
||||
String device_code = pdmBiDevice.getDevice_code();
|
||||
int indexOf = device_code.lastIndexOf("_");
|
||||
String substring = device_code.substring(indexOf + 1);
|
||||
return Integer.valueOf(substring).equals(Integer.valueOf(item.getDevice_code()));
|
||||
}).collect(Collectors.toList());
|
||||
if(CollectionUtils.isEmpty(deviceCollect) || deviceCollect.size() > 1) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "设备名称:" + item.getDevice_code() + "不存在了!!");
|
||||
}
|
||||
else{
|
||||
item.setDevice_code(deviceCollect.get(0).getDevice_code());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(item.getDevice_code())){
|
||||
if("1535144356586165920".equals(item.getWorkprocedure_id())) {
|
||||
item.setDevice_code("A1_DC_" + item.getDevice_code().replaceAll("-", "_"));
|
||||
}
|
||||
else if("1535143882327724032".equals(item.getWorkprocedure_id())) {
|
||||
item.setDevice_code("A1_XY_" + item.getDevice_code().replaceAll("-", "_"));
|
||||
}
|
||||
else{
|
||||
List<PdmBiDevice> deviceCollect = devices.stream().filter(pdmBiDevice ->
|
||||
{
|
||||
String device_code = pdmBiDevice.getDevice_code();
|
||||
int indexOf = device_code.lastIndexOf("_");
|
||||
String substring = device_code.substring(indexOf + 1);
|
||||
return Integer.valueOf(substring).equals(Integer.valueOf(item.getDevice_code()));
|
||||
}).collect(Collectors.toList());
|
||||
if(CollectionUtils.isEmpty(deviceCollect) || deviceCollect.size() > 1) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "设备名称:" + item.getDevice_code() + "不存在了!!");
|
||||
}
|
||||
else{
|
||||
item.setDevice_code(deviceCollect.get(0).getDevice_code());
|
||||
}
|
||||
}
|
||||
}else {
|
||||
item.setDevice_code(null);
|
||||
}
|
||||
}
|
||||
if(!CollectionUtils.isEmpty(errorMap)) {
|
||||
@@ -838,7 +866,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
//1-创建、2-下发、3-生产中、4-暂停、6-完成
|
||||
//判断该工单状态
|
||||
try {
|
||||
PdmProduceWorkorder result = this.getOne(new QueryWrapper<PdmProduceWorkorder>().eq("device_code", param.getString("device_code")).in("workorder_status", "3", "4").eq("is_delete", false).ne("workorder_id", param.getString("workorder_id")));
|
||||
PdmProduceWorkorder result = this.getOne(new QueryWrapper<PdmProduceWorkorder>().eq("device_code", param.getString("device_code")).in("workorder_status", "3").eq("is_delete", false).ne("workorder_id", param.getString("workorder_id")));
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
throw new BadRequestException("已有工单选择该设备开工,请更换开工设备!");
|
||||
}
|
||||
|
||||
@@ -39,6 +39,13 @@ public class StIvtStructivtCpController {
|
||||
return new ResponseEntity<>(iStIvtStructivtCpService.packageQuery(query,page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/queryGroup")
|
||||
@Log("成品库存查询")
|
||||
//("成品库存查询")
|
||||
public ResponseEntity<Object> queryGroup(CpIvtQuery query, PageQuery page) {
|
||||
return new ResponseEntity<>(iStIvtStructivtCpService.groupQuery(query,page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getStructIvt")
|
||||
@Log("查询库存")
|
||||
//("查询库存")
|
||||
|
||||
@@ -27,6 +27,14 @@ public interface IStIvtStructivtCpService extends IService<StIvtStructivtCp> {
|
||||
*/
|
||||
Object packageQuery(CpIvtQuery query, PageQuery page);
|
||||
|
||||
/**
|
||||
* 出库查询(合并)
|
||||
* @param query
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
Object groupQuery(CpIvtQuery query, PageQuery page);
|
||||
|
||||
/**
|
||||
* 成品库存更新
|
||||
* @param json
|
||||
|
||||
@@ -31,6 +31,8 @@ public interface StIvtStructivtCpMapper extends BaseMapper<StIvtStructivtCp> {
|
||||
|
||||
List<Map> packageQuery(@Param("query") CpIvtQuery query);
|
||||
|
||||
List<Map> groupQuery(@Param("query") CpIvtQuery query);
|
||||
|
||||
List<Map> getStructAll(@Param("chanList") List<String> list);
|
||||
|
||||
List<JSONObject> getIvtPor();
|
||||
|
||||
@@ -198,6 +198,65 @@
|
||||
</where>
|
||||
order by ivt.instorage_time DESC,attr.struct_code ASC
|
||||
</select>
|
||||
<select id="groupQuery" resultType="java.util.Map">
|
||||
SELECT
|
||||
attr.stor_name,
|
||||
attr.sect_name,
|
||||
ivt.struct_code,
|
||||
ivt.struct_name,
|
||||
GROUP_CONCAT(mater.material_id) as material_id,
|
||||
GROUP_CONCAT(mater.material_name) as material_name,
|
||||
GROUP_CONCAT(mater.material_spec) as material_spec,
|
||||
GROUP_CONCAT(mater.material_code) as material_code,
|
||||
attr.storagevehicle_code,
|
||||
sum(ivt.canuse_qty) canuse_qty,
|
||||
sum(ivt.frozen_qty) frozen_qty,
|
||||
sum(ivt.ivt_qty) ivt_qty,
|
||||
sum(ivt.warehousing_qty) warehousing_qty,
|
||||
ivt.bill_type,
|
||||
unit.unit_name,
|
||||
unit.measure_unit_id,
|
||||
ivt.instorage_time,
|
||||
sale.sale_code,
|
||||
GROUP_CONCAT(sale.seq_no) as seq_no,
|
||||
sale.sale_id,
|
||||
sale.sale_type
|
||||
FROM
|
||||
st_ivt_structivt_cp ivt
|
||||
LEFT JOIN md_me_materialbase mater ON ivt.material_id = mater.material_id
|
||||
LEFT JOIN st_ivt_structattr attr ON attr.struct_id = ivt.struct_id
|
||||
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = ivt.qty_unit_id
|
||||
LEFT JOIN mps_sale_order sale ON sale.sale_id = ivt.sale_id
|
||||
<where>
|
||||
1=1
|
||||
<if test="query.material_code!= null and query.material_code != ''">
|
||||
and mater.material_code LIKE #{query.material_code} or
|
||||
(mater.material_name LIKE #{query.material_code}) or
|
||||
(mater.material_spec LIKE #{query.material_code})
|
||||
</if>
|
||||
<if test="query.struct_code!= null and query.struct_code != ''">
|
||||
and attr.struct_code LIKE #{query.struct_code} or
|
||||
(attr.struct_name LIKE #{query.struct_code})
|
||||
</if>
|
||||
<if test="query.sale_code!= null and query.sale_code != ''">
|
||||
and sale.sale_code LIKE #{query.sale_code}
|
||||
</if>
|
||||
<if test="query.seq_no!= null and query.seq_no != ''">
|
||||
and sale.seq_no LIKE #{query.seq_no}
|
||||
</if>
|
||||
<if test="query.lock_type!= null and query.lock_type != ''">
|
||||
and attr.lock_type = #{query.lock_type}
|
||||
</if>
|
||||
<if test="query.start_time!= null and query.start_time != ''">
|
||||
and ivt.instorage_time >= #{query.start_time}
|
||||
</if>
|
||||
<if test="query.end_time!= null and query.end_time != ''">
|
||||
and ivt.instorage_time <= #{query.end_time}
|
||||
</if>
|
||||
</where>
|
||||
group by attr.struct_code
|
||||
order by ivt.instorage_time DESC,attr.struct_code ASC
|
||||
</select>
|
||||
|
||||
<select id="getStructAll" resultType="java.util.Map">
|
||||
SELECT
|
||||
|
||||
@@ -70,6 +70,15 @@ public class StIvtStructivtCpServiceImpl extends ServiceImpl<StIvtStructivtCpMap
|
||||
return build;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object groupQuery(CpIvtQuery query, PageQuery pageQuery) {
|
||||
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
|
||||
TableDataInfo build = TableDataInfo.build(this.baseMapper.groupQuery(query));
|
||||
build.setTotalElements(page.getTotal());
|
||||
|
||||
return build;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void UpdateIvt(JSONObject json) {
|
||||
|
||||
Reference in New Issue
Block a user