This commit is contained in:
2022-08-19 11:07:47 +08:00
16 changed files with 749 additions and 36 deletions

View File

@@ -179,7 +179,7 @@ public class HandReturnOutIvtServiceImpl implements HandReturnOutIvtService {
int seq_no = 1;
//所有桶的总数
BigDecimal sum_qty = new BigDecimal(0);
BigDecimal sum_qty = BigDecimal.valueOf(disObj.getDoubleValue("real_qty"));
for (int i = 0; i < dtl.size(); i++) {
JSONObject dtljo = dtl.getJSONObject(i);
String bucketunique = dtljo.getString("bucketunique");
@@ -289,6 +289,11 @@ public class HandReturnOutIvtServiceImpl implements HandReturnOutIvtService {
}
// 10更新【出入库分配表】
disObj.put("real_qty", sum_qty);
BigDecimal qty_flag_dis = NumberUtil.sub(sum_qty, disObj.getDoubleValue("plan_qty"));
if(qty_flag_dis.doubleValue() > 0){
throw new PdaRequestException("总出库数大于计划出库数!");
}
dis_table.update(disObj);
//11 更新【出入库明细表】
WQLObject iosdlt_table = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl");

View File

@@ -9,6 +9,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.nl.exception.BadRequestException;
import org.nl.ext.lk.service.WmsToLkService;
import org.nl.wms.lk.service.LibraryqueryService;
import org.nl.wql.WQL;
@@ -72,6 +73,9 @@ public class LibraryqueryServiceImpl implements LibraryqueryService {
JSONArray resultJSONArray = WQL.getWO("QLK01").addParam("flag", "2").addParam("pallet_code",pallet_code).setDbname("dataSource2").process().getResultJSONArray(0);
for (int i = 0; i < resultJSONArray.size(); i++) {
JSONObject jsonResultDtl = resultJSONArray.getJSONObject(i);
if (ObjectUtil.isEmpty(jsonResultDtl.getString("barrelcode"))) {
throw new BadRequestException("该托盘存在没有桶码情况,请在立库系统进行出库操作,出库后重新打印标签粘贴!");
}
JSONObject jsonData = new JSONObject();
jsonData.put("material_uuid", jsonResultDtl.getString("material_uuid"));
JSONObject jsonMater = WQLObject.getWQLObject("md_me_materialbase").query("ext_id = '" + jsonResultDtl.getString("material_uuid") + "'").uniqueResult(0);

View File

@@ -15,6 +15,8 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
@RestController
@@ -99,4 +101,9 @@ public class WorkOrderController {
public ResponseEntity<Object> getDepts(@RequestParam Map whereJson) {
return new ResponseEntity<>(workOrdereService.getDepts(whereJson),HttpStatus.OK);
}
@ApiOperation("导出数据")
@GetMapping(value = "/download")
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
workOrdereService.download(whereJson, response);
}
}

View File

@@ -6,6 +6,8 @@ import com.alibaba.fastjson.JSONObject;
import org.nl.wms.pdm.service.dto.ProcessrouteDto;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@@ -69,4 +71,10 @@ public interface WorkOrdereService {
* @param whereJson /
*/
JSONArray getDepts(Map whereJson);
/**
* 导出数据
*
* @param whereJson /
*/
void download(Map whereJson, HttpServletResponse response) throws IOException;
}

View File

@@ -75,7 +75,7 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
map.put("task_code", "%" + task_code + "%");
}
map.put("flag", "2");
JSONObject json = WQL.getWO("QPDM_PRODUCTPLANPROC").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "deviceinfo.device_code,pp.plan_finish_date,ext.old_mark,pp.material_code");
JSONObject json = WQL.getWO("QPDM_PRODUCTPLANPROC").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "pp.plan_finish_date,pp.material_code,pp.plan_org_code");
return json;
}

View File

@@ -16,6 +16,7 @@ import com.alibaba.fastjson.JSONObject;
import org.nl.exception.BadRequestException;
import org.nl.modules.security.service.dto.JwtUserDto;
import org.nl.modules.system.util.CodeUtil;
import org.nl.utils.FileUtil;
import org.nl.utils.SecurityUtils;
import org.nl.wms.pdm.service.ProcessrouteService;
import org.nl.wms.pdm.service.WorkOrdereService;
@@ -28,10 +29,9 @@ import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
@Service
@RequiredArgsConstructor
@@ -163,7 +163,7 @@ public class WorkOrderServiceImpl implements WorkOrdereService {
JSONObject old2 = mstTab.query("workorder_id='"+workorder_id+"'").uniqueResult(0);
if(old2!=null){
String pcsn_old = old2.getString("pcsn");
if(!pcsn_old.equals("pcsn")){
if(!pcsn_old.equals(pcsn)){
this.updatePcsn(whereJson);
}
}
@@ -814,4 +814,107 @@ public class WorkOrderServiceImpl implements WorkOrdereService {
return ret;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void download(Map whereJson, HttpServletResponse response) throws IOException {
HashMap<String, String> map = new HashMap<>(whereJson);
map.put("flag", "15");
String workorder_code = map.get("workorder_code");
if (StrUtil.isNotEmpty(workorder_code)) {
map.put("workorder_code", "%" + workorder_code + "%");
}
String pcsn = map.get("pcsn");
if (StrUtil.isNotEmpty(pcsn)) {
map.put("pcsn", "%" + pcsn + "%");
}
String material_id = map.get("material_id");
if (StrUtil.isNotEmpty(material_id)) {
map.put("material_id", "%" + material_id + "%");
}
String begin_time = map.get("begin_time");
if (StrUtil.isNotEmpty(begin_time)) {
map.put("begin_time", begin_time.substring(0,10)+" 00:00:00");
}
String end_time = map.get("end_time");
if (StrUtil.isNotEmpty(end_time)) {
map.put("end_time", end_time.substring(0,10)+" 23:59:59");
}
String device_code = map.get("device_code");
if (StrUtil.isNotEmpty(device_code)) {
map.put("device_code", "%" + device_code + "%");
}
JSONArray jsonArr = WQL.getWO("QPDM_WORKORDER01").addParamMap(map).process().getResultJSONArray(0);
List<Map<String, Object>> list = new ArrayList<>();
WQLObject md_pb_classstandard = WQLObject.getWQLObject("md_pb_classstandard");
WQLObject pdm_bi_workprocedure = WQLObject.getWQLObject("pdm_bi_workprocedure");
for (int i = 0; i < jsonArr.size(); i++) {
JSONObject json = jsonArr.getJSONObject(i);
Map<String, Object> paramMap = new LinkedHashMap<>();
paramMap.put("工令日期", json.getString("planstart_time").substring(0,10));
paramMap.put("工令号", json.getString("workorder_code"));
paramMap.put("所属组织", json.getString("org_name"));
String workorder_type = json.getString("workorder_type");
paramMap.put("工令类型", "科研工令");
if(workorder_type.equals("01")){
paramMap.put("工令类型", "生产工令");
}
//10生成、20提交、30开单中、40已开单、50开工、60暂停、99完工
String status = json.getString("status");
paramMap.put("工令状态", "生成");
if(status.equals("20")){
paramMap.put("工令状态", "提交");
}else if(status.equals("30")){
paramMap.put("工令状态", "开单中");
}else if(status.equals("40")){
paramMap.put("工令状态", "已开单");
}else if(status.equals("50")){
paramMap.put("工令状态", "开工");
}else if(status.equals("60")){
paramMap.put("工令状态", "暂停");
}else if(status.equals("99")){
paramMap.put("工令状态", "完工");
}
paramMap.put("设备", json.getString("device_name"));
paramMap.put("物料编码", json.getString("material_code"));
paramMap.put("牌号", json.getString("old_mark"));
String product_series_id = json.getString("product_series_id");
JSONObject product_series = md_pb_classstandard.query("class_id='"+product_series_id+"'").uniqueResult(0);
paramMap.put("系列", product_series_id);
if(product_series!=null){
paramMap.put("系列", product_series.getString("class_name"));
}
paramMap.put("批次", json.getString("pcsn"));
paramMap.put("重量", json.getString("workorder_qty"));
paramMap.put("开单总重量", json.getString("bill_qty"));
paramMap.put("实际生产重量", json.getString("productin_qty"));
paramMap.put("单位", json.getString("qty_unit_name"));
paramMap.put("计划开始时间", json.getString("planstart_time"));
paramMap.put("计划结束时间", json.getString("planend_time"));
paramMap.put("实际开始时间", json.getString("realstart_time"));
paramMap.put("实际结束时间", json.getString("realend_time"));
String source_bill_type = json.getString("source_bill_type");
paramMap.put("源类型", "生产计划");
if(source_bill_type.equals("02")){
paramMap.put("源类型", "临时计划");
}
paramMap.put("来源单据编号", json.getString("source_bill_code"));
String workprocedure_id = json.getString("workprocedure_id");
paramMap.put("当前工序", workprocedure_id);
JSONObject workprocedure = pdm_bi_workprocedure.query("workprocedure_id='"+workprocedure_id+"'").uniqueResult(0);
if(workprocedure!=null){
paramMap.put("当前工序", workprocedure.getString("workprocedure_name"));
}
paramMap.put("开工人", json.getString("startwork_name"));
paramMap.put("完工人", json.getString("endwork_name"));
paramMap.put("创建人", json.getString("create_name"));
paramMap.put("修改人", json.getString("update_optname"));
paramMap.put("备注", json.getString("remark"));
list.add(paramMap);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -216,6 +216,60 @@
ENDQUERY
ENDIF
IF 输入.flag = "15"
QUERY
SELECT
WorkOrder.*, mb.material_code,
mb.material_name,
mb.ext_id,
device.device_code,
producmaterialext.old_mark,
device.device_name,
Formula.create_name AS formula_name,
Formula.create_time AS formula_time,
productdeptpcsn.org_name
FROM
PDM_BI_WorkOrder WorkOrder
LEFT JOIN md_me_materialbase mb ON mb.material_id = WorkOrder.material_id
LEFT JOIN md_me_producmaterialext producmaterialext ON mb.material_id = producmaterialext.material_id
LEFT JOIN em_bi_deviceinfo device ON device.device_id = WorkOrder.device_id
LEFT JOIN PDM_BI_Formula Formula ON (Formula.workorder_id = WorkOrder.workorder_id and Formula.bucket_type='01' AND Formula.is_delete = '0')
LEFT JOIN pdm_bi_productdeptpcsn productdeptpcsn ON productdeptpcsn.org_id = WorkOrder.org_id
WHERE
WorkOrder.is_delete = '0'
OPTION 输入.workorder_code <> ""
WorkOrder.workorder_code like 输入.workorder_code
ENDOPTION
OPTION 输入.device_code <> ""
(device.device_code like 输入.device_code or
device.device_name like 输入.device_code)
ENDOPTION
OPTION 输入.pcsn <> ""
WorkOrder.pcsn like 输入.pcsn
ENDOPTION
OPTION 输入.status <> ""
WorkOrder.status = 输入.status
ENDOPTION
OPTION 输入.workorder_type <> ""
WorkOrder.workorder_type = 输入.workorder_type
ENDOPTION
OPTION 输入.material_id <> ""
(mb.material_code like 输入.material_id or mb.material_name like 输入.material_id)
ENDOPTION
OPTION 输入.begin_time <> ""
WorkOrder.planstart_time >= 输入.begin_time
ENDOPTION
OPTION 输入.end_time <> ""
WorkOrder.planstart_time <= 输入.end_time
ENDOPTION
OPTION 输入.org_id <> ""
WorkOrder.org_id = 输入.org_id
ENDOPTION
order by WorkOrder.planstart_time,mb.material_code,WorkOrder.pcsn
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -67,8 +67,6 @@ public class AutoformulaServiceImpl implements AutoformulaService {
String material_id = json.getString("material_id");
//成品物料编码
String material_code = json.getString("material_code");
//成品纯粉系数
double material_net_rate = json.getDouble("net_rate");
//需配软废集合
JSONArray rf_list = new JSONArray();
//需配新料集合
@@ -496,8 +494,6 @@ public class AutoformulaServiceImpl implements AutoformulaService {
String material_id = json.getString("material_id");
//成品物料编码
String material_code = json.getString("material_code");
//成品纯粉系数
double material_net_rate = json.getDouble("net_rate");
//需配软废集合
JSONArray rf_list = new JSONArray();
//需配新料集合
@@ -1423,8 +1419,6 @@ public class AutoformulaServiceImpl implements AutoformulaService {
String material_id = json.getString("material_id");
//成品物料编码
String material_code = json.getString("material_code");
//成品纯粉系数
double material_net_rate = json.getDouble("net_rate");
//需配软废集合
JSONArray rf_list = new JSONArray();
//需配新料集合
@@ -1515,15 +1509,15 @@ public class AutoformulaServiceImpl implements AutoformulaService {
for(int i=0;i<ivts_new.size();i++){
JSONObject ivt_new = ivts_new.getJSONObject(i);
double ivt_qty = ivt_new.getDouble("sum_ivt_qty");
double net_rate = ivt_new.getDouble("net_rate");
ivt_qty = NumberUtil.roundDown(ivt_qty,3).doubleValue();
double formula_qty = 0;
double rf_up = rf_left_weight.doubleValue()/(material_net_rate/100.0);
double rf_up = rf_left_weight.doubleValue()/(net_rate/100.0);
if(ivt_qty<rf_up){
formula_qty = ivt_qty;
}else{
formula_qty = rf_up;
}
double net_rate = ivt_new.getDouble("net_rate");
double now_ivt_qty = formula_qty * net_rate / 100.0;
//已分配软废总量
@@ -2506,8 +2500,6 @@ public class AutoformulaServiceImpl implements AutoformulaService {
String material_id = json.getString("material_id");
//成品物料编码
String material_code = json.getString("material_code");
//成品纯粉系数
double material_net_rate = json.getDouble("net_rate");
//需配软废集合
JSONArray rf_list = new JSONArray();
//需配新料集合
@@ -2807,8 +2799,6 @@ public class AutoformulaServiceImpl implements AutoformulaService {
String material_id = json.getString("material_id");
//成品物料编码
String material_code = json.getString("material_code");
//成品纯粉系数
double material_net_rate = json.getDouble("net_rate");
//需配软废集合
JSONArray rf_list = new JSONArray();
//需配新料集合

View File

@@ -211,7 +211,9 @@ public class FormulaServiceImpl implements FormulaService {
JSONObject jo = tableDtl.getJSONObject(i);
String formuladtl_id = jo.getString("formuladtl_id");
jo.put("seq_no",(i+1)+"");
if(StrUtil.isEmpty(formuladtl_id)){//新增
//新增
if(StrUtil.isEmpty(formuladtl_id)){
jo.put("put_qty","0");
jo.put("formula_id",formula_id);
jo.put("formuladtl_id",IdUtil.getSnowflake(1, 1).nextId());
jo.put("formula_code",Formula.getString("formula_code"));
@@ -228,6 +230,27 @@ public class FormulaServiceImpl implements FormulaService {
if(StrUtil.isEmpty(jo.getString("qty_unit_name"))){
jo.put("qty_unit_name","千克\\公斤");
}
//判断库存
if("1".equals(jo.getString("is_need_move"))){
//校验库存是否够
JSONObject jo_ivt = WQL.getWO("QPF_INITFORMULA01")
.addParam("material_id",jo.getString("material_id"))
.addParam("pcsn",jo.getString("pcsn"))
.addParam("quality_scode",jo.getString("quality_scode"))
.addParam("ivt_level",jo.getString("ivt_level"))
.addParam("is_active",jo.getString("is_active"))
.addParam("flag","3")
.process().uniqueResult(0);
if(jo_ivt!=null){
double sum_ivt_qty = jo_ivt.getDouble("sum_ivt_qty");
if(sum_ivt_qty<jo.getDouble("formula_qty")){
throw new BadRequestException("物料"+jo.getString("material_code")+" "+jo.getString("material_name")+"库存不足!");
}
}else{
throw new BadRequestException("物料"+jo.getString("material_code")+" "+jo.getString("material_name")+"库存不足!");
}
}
}else{
}
@@ -691,6 +714,7 @@ public class FormulaServiceImpl implements FormulaService {
HashMap<String, Object> oneMap = new HashMap<>();
// 工令相关
oneMap.put("workorder_code", jsonWork.getString("workorder_code"));
oneMap.put("material_code", jsonMater.getString("material_code"));
if (ObjectUtil.isNotEmpty(jsonDept)) oneMap.put("dept_name", jsonDept.getString("name"));
if (ObjectUtil.isNotEmpty(jsonMaterExt)) oneMap.put("old_mark", jsonMaterExt.getString("old_mark"));
@@ -765,8 +789,7 @@ public class FormulaServiceImpl implements FormulaService {
// 球磨
oneMap.put("ball_speed", jsonMaterExt.getString("ball_speed"));
JSONObject jsonQM08 = paraTab.query("material_id = '" + material_id + "' and para_code = 'QM008'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonQM08)) oneMap.put("number_3", jsonQM08.getString("value"));
oneMap.put("number_3", jsonMst.getString("ball_time"));
oneMap.put("create_name", jsonMst.getString("create_name"));
// 查询配方明细-辅料

View File

@@ -333,9 +333,9 @@
classstandard.class_code
FROM
MD_PD_ProductMaterialSet ProductMaterialSet
LEFT JOIN md_me_producmaterialext producmaterialext ON producmaterialext.material_id = ProductMaterialSet.material_id
left join md_me_materialbase materialbase on materialbase.material_id = ProductMaterialSet.set_material_id
LEFT JOIN md_pb_classstandard classstandard ON classstandard.class_id = materialbase.material_type_id
LEFT JOIN md_me_producmaterialext producmaterialext ON producmaterialext.material_id = materialbase.material_id
WHERE
1 = 1
and producmaterialext.net_rate>0