add:增加aps的Bom数据相关功能;rev:修改一些uuid改为id,optid,optName改为id,name;
This commit is contained in:
@@ -22,7 +22,7 @@ public class BaseDto implements Serializable {
|
||||
|
||||
private String update_name;
|
||||
|
||||
private String update_optid;
|
||||
private String update_id;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
Binary file not shown.
@@ -71,7 +71,7 @@ public class MdMeMaterialbaseServiceImpl extends ServiceImpl<MdMeMaterialbaseMap
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
continue;
|
||||
}
|
||||
String material_code = (String) list.get(0);
|
||||
String material_code = list.get(0).toString();
|
||||
if (StrUtil.isEmpty(material_code)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "物料编码为空!");
|
||||
}
|
||||
@@ -82,26 +82,30 @@ public class MdMeMaterialbaseServiceImpl extends ServiceImpl<MdMeMaterialbaseMap
|
||||
material_jo.setMaterial_code(material_code);
|
||||
need_update = false;
|
||||
}
|
||||
String material_name = (String) list.get(1);
|
||||
String material_name = list.get(1).toString();
|
||||
if (StrUtil.isEmpty(material_name)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "物料名称为空!");
|
||||
} else {
|
||||
material_jo.setMaterial_name(material_name);
|
||||
}
|
||||
String material_spec = (String) list.get(2);
|
||||
if (StrUtil.isNotEmpty(material_spec)) {
|
||||
String material_spec = null == list.get(2) ? "" : String.valueOf( list.get(2));
|
||||
if (StrUtil.isNotEmpty(material_spec)&&!"1".equals(material_spec)) {
|
||||
material_jo.setMaterial_spec(material_spec);
|
||||
}
|
||||
|
||||
String material_model = (String) list.get(3);
|
||||
if (StrUtil.isNotEmpty(material_model)) {
|
||||
material_jo.setMaterial_model(material_model);
|
||||
}
|
||||
|
||||
String material_type = (String) list.get(4);
|
||||
if (StrUtil.isEmpty(material_type)) {
|
||||
String product_series = list.get(3).toString();
|
||||
// if (StrUtil.isNotEmpty(product_series)&&!"1".equals(material_spec)) {
|
||||
// //查询对应的系列名称
|
||||
// MdPbClassstandard class_jo = classstandardService.getOne(new QueryWrapper<MdPbClassstandard>().eq("class_name", product_series).eq("is_delete", false));
|
||||
// if (ObjectUtil.isEmpty(class_jo)) {
|
||||
// errorMap.put("第" + (i + 1) + "行:", "系列分类编码对应的分类不存在!");
|
||||
// continue;
|
||||
// }
|
||||
// material_jo.setProduct_series(class_jo.getClass_id());
|
||||
// }
|
||||
String material_type = list.get(4).toString();
|
||||
if (StrUtil.isEmpty(material_type)&&!"1".equals(material_spec)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "物料分类编码为空!");
|
||||
}else {
|
||||
}else{
|
||||
//查询对应的系列名称
|
||||
MdPbClassstandard class_jo = classstandardService.getOne(new QueryWrapper<MdPbClassstandard>().eq("class_name", material_type).eq("is_delete", false));
|
||||
if (ObjectUtil.isEmpty(class_jo)) {
|
||||
@@ -110,20 +114,12 @@ public class MdMeMaterialbaseServiceImpl extends ServiceImpl<MdMeMaterialbaseMap
|
||||
}
|
||||
material_jo.setMaterial_type_id(class_jo.getClass_id());
|
||||
}
|
||||
|
||||
String product_series = (String) list.get(5);
|
||||
if (StrUtil.isNotEmpty(product_series)) {
|
||||
//查询对应的系列名称
|
||||
MdPbClassstandard class_jo = classstandardService.getOne(new QueryWrapper<MdPbClassstandard>().eq("class_name", product_series).eq("is_delete", false));
|
||||
if (ObjectUtil.isEmpty(class_jo)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "系列分类编码对应的分类不存在!");
|
||||
continue;
|
||||
}
|
||||
material_jo.setProduct_series(class_jo.getClass_id());
|
||||
String material_model = list.get(5).toString();
|
||||
if (StrUtil.isNotEmpty(material_model)&&!"1".equals(material_spec)) {
|
||||
material_jo.setMaterial_model(material_model);
|
||||
}
|
||||
|
||||
String unit_name = (String) list.get(6);
|
||||
if (StrUtil.isEmpty(unit_name)) {
|
||||
String unit_name = list.get(6).toString();
|
||||
if (StrUtil.isEmpty(unit_name)&&!"1".equals(material_spec)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "单位为空!");
|
||||
}else {
|
||||
MdPbMeasureunit unit_jo = measureunitService.getOne(new QueryWrapper<MdPbMeasureunit>().eq("unit_name", unit_name));
|
||||
@@ -134,8 +130,8 @@ public class MdMeMaterialbaseServiceImpl extends ServiceImpl<MdMeMaterialbaseMap
|
||||
material_jo.setBase_unit_id(unit_jo.getMeasure_unit_id());
|
||||
}
|
||||
|
||||
String net_weight = String.valueOf(list.get(7));
|
||||
if (StrUtil.isEmpty(net_weight)) {
|
||||
String net_weight = list.get(7).toString();
|
||||
if (StrUtil.isEmpty(net_weight)&&!"1".equals(material_spec)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "单重为空!");
|
||||
}else {
|
||||
material_jo.setNet_weight(new BigDecimal(net_weight));
|
||||
|
||||
@@ -131,8 +131,8 @@ public class SemirealrawmaterialServiceImpl implements SemirealrawmaterialServic
|
||||
map.put("raw_material_id", raw_material_id);
|
||||
map.put("rate_qty", rate_qty);
|
||||
map.put("workprocedure_id", workprocedure_id);
|
||||
map.put("update_optid", currentUserId);
|
||||
map.put("update_optname", nickName);
|
||||
map.put("update_id", currentUserId);
|
||||
map.put("update_name", nickName);
|
||||
map.put("update_time", DateUtil.now());
|
||||
WQLObject wo = WQLObject.getWQLObject("md_me_semirealrawmaterial");
|
||||
wo.update(map, "relation_id = '" + relation_id + "'");
|
||||
@@ -149,13 +149,14 @@ public class SemirealrawmaterialServiceImpl implements SemirealrawmaterialServic
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("relation_id", String.valueOf(relation_id));
|
||||
param.put("raw_material_id", "");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_id", currentUserId);
|
||||
param.put("update_name", nickName);
|
||||
param.put("update_time", DateUtil.now());
|
||||
wo.update(param);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void excelImport(MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
InputStream inputStream = file.getInputStream();
|
||||
@@ -168,19 +169,7 @@ public class SemirealrawmaterialServiceImpl implements SemirealrawmaterialServic
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
continue;
|
||||
}
|
||||
String workprocedure_code = (String) list.get(0);
|
||||
if (StrUtil.isEmpty(workprocedure_code)){
|
||||
errorMap.put("第" + (i + 1) + "行:", "工序编码为空!");
|
||||
continue;
|
||||
}
|
||||
|
||||
PdmBiWorkprocedure workprocedure = workprocedureService.getOne(new QueryWrapper<PdmBiWorkprocedure>().eq("workprocedure_code", workprocedure_code));
|
||||
if (ObjectUtil.isEmpty(workprocedure)) {
|
||||
errorMap.put("第" + (i + 1) + "行:", "为查询到该工序编号对应的工序!");
|
||||
continue;
|
||||
}
|
||||
|
||||
String semi_material_code = (String) list.get(1);
|
||||
String semi_material_code = (String) list.get(0);
|
||||
if (StrUtil.isEmpty(semi_material_code)){
|
||||
errorMap.put("第" + (i + 1) + "行:", "半成品物料编码为空!");
|
||||
continue;
|
||||
@@ -193,7 +182,7 @@ public class SemirealrawmaterialServiceImpl implements SemirealrawmaterialServic
|
||||
continue;
|
||||
}
|
||||
|
||||
String raw_material_code = String.valueOf(list.get(2));
|
||||
String raw_material_code = String.valueOf(list.get(1));
|
||||
if (StrUtil.isEmpty(raw_material_code)){
|
||||
errorMap.put("第" + (i + 1) + "行:", "原材料物料编码为空!");
|
||||
continue;
|
||||
@@ -206,7 +195,7 @@ public class SemirealrawmaterialServiceImpl implements SemirealrawmaterialServic
|
||||
continue;
|
||||
}
|
||||
|
||||
String rate_qty = String.valueOf(list.get(3));
|
||||
String rate_qty = String.valueOf(list.get(2));
|
||||
if (StrUtil.isEmpty(rate_qty)){
|
||||
errorMap.put("第" + (i + 1) + "行:", "原材料消耗重量为空!");
|
||||
continue;
|
||||
@@ -217,7 +206,6 @@ public class SemirealrawmaterialServiceImpl implements SemirealrawmaterialServic
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jo)){
|
||||
jo.put("rate_qty",rate_qty);
|
||||
jo.put("workprocedure_id",workprocedure.getWorkprocedure_id());
|
||||
WQLObject.getWQLObject("md_me_semirealrawmaterial").update(jo);
|
||||
}else {
|
||||
jo = new JSONObject();
|
||||
@@ -225,12 +213,12 @@ public class SemirealrawmaterialServiceImpl implements SemirealrawmaterialServic
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
jo.put("relation_id",IdUtil.getSnowflake(1, 1).nextId());
|
||||
jo.put("semi_material_id",semi_jo.getMaterial_id());
|
||||
jo.put("raw_material_id",semi_jo.getMaterial_id());
|
||||
jo.put("raw_material_id",raw_jo.getMaterial_id());
|
||||
jo.put("raw_material_code",raw_jo.getMaterial_code());
|
||||
jo.put("create_id",currentUserId);
|
||||
jo.put("create_name",nickName);
|
||||
jo.put("create_time",DateUtil.now());
|
||||
jo.put("rate_qty",rate_qty);
|
||||
jo.put("workprocedure_id",workprocedure.getWorkprocedure_id());
|
||||
WQLObject wo = WQLObject.getWQLObject("md_me_semirealrawmaterial");
|
||||
wo.insert(jo);
|
||||
}
|
||||
|
||||
@@ -144,7 +144,6 @@ public class MpsSaleOrderServiceImpl extends ServiceImpl<MpsSaleOrderMapper,MpsS
|
||||
if(ObjectUtil.isEmpty(list)) {
|
||||
continue;
|
||||
}
|
||||
String error_message = "";
|
||||
MpsSaleOrder mpsSaleOrder = new MpsSaleOrder();
|
||||
mpsSaleOrder.setSale_type("01");
|
||||
mpsSaleOrder.setStatus("10");
|
||||
@@ -185,7 +184,6 @@ public class MpsSaleOrderServiceImpl extends ServiceImpl<MpsSaleOrderMapper,MpsS
|
||||
List<MdMeMaterialbase> meMaterialBases = materialbaseService.list(new QueryWrapper<MdMeMaterialbase>().like("material_spec", col));
|
||||
if(CollectionUtils.isEmpty(meMaterialBases)) {
|
||||
errorMap.put("第" + i + "行" + col, "物料规格对应物料信息不存在");
|
||||
error_message = error_message + col + "物料规格对应物料信息不存在,";
|
||||
}
|
||||
else{
|
||||
Optional<MdMeMaterialbase> first = meMaterialBases.stream().findFirst();
|
||||
|
||||
@@ -72,12 +72,12 @@ public class PdmBiProcessroute implements Serializable {
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optid;
|
||||
private String update_id;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String update_optname;
|
||||
private String update_name;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
|
||||
@@ -114,9 +114,9 @@ public class PdmBiProcessrouteServiceImpl extends ServiceImpl<PdmBiProcessrouteM
|
||||
processroute.setProcessroute_name(whereJson.getString("processroute_name"));
|
||||
processroute.setRemark(whereJson.getString("remark"));
|
||||
processroute.setDetail_count(new BigDecimal(dataArr.size()));
|
||||
processroute.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
processroute.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
processroute.setUpdate_time(DateUtil.now());
|
||||
processroute.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
processroute.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
this.updateById(processroute);
|
||||
// 更新明细表
|
||||
List<PdmBiProcessroutedtl> dtlArr = pdmBiProcessroutedtlService.list(new QueryWrapper<PdmBiProcessroutedtl>().eq("processroute_id", processroute_id));
|
||||
@@ -154,8 +154,8 @@ public class PdmBiProcessrouteServiceImpl extends ServiceImpl<PdmBiProcessrouteM
|
||||
public void deleteAll(Long[] ids) {
|
||||
this.update(new UpdateWrapper<PdmBiProcessroute>()
|
||||
.set("is_delete","1")
|
||||
.set("update_optid",SecurityUtils.getCurrentUserId())
|
||||
.set("update_optname",SecurityUtils.getCurrentNickName())
|
||||
.set("update_id",SecurityUtils.getCurrentUserId())
|
||||
.set("update_name",SecurityUtils.getCurrentNickName())
|
||||
.set("update_time",DateUtil.now())
|
||||
.in("processroute_id",ids));
|
||||
}
|
||||
@@ -178,8 +178,8 @@ public class PdmBiProcessrouteServiceImpl extends ServiceImpl<PdmBiProcessrouteM
|
||||
public void CancelSubmit(JSONObject whereJson) {
|
||||
this.update(new UpdateWrapper<PdmBiProcessroute>()
|
||||
.set("processroute_status","10")
|
||||
.set("update_optid",SecurityUtils.getCurrentUserId())
|
||||
.set("update_optname",SecurityUtils.getCurrentNickName())
|
||||
.set("update_id",SecurityUtils.getCurrentUserId())
|
||||
.set("update_name",SecurityUtils.getCurrentNickName())
|
||||
.set("update_time",DateUtil.now())
|
||||
.set("audit_id"," ")
|
||||
.set("audit_name"," ")
|
||||
@@ -191,8 +191,8 @@ public class PdmBiProcessrouteServiceImpl extends ServiceImpl<PdmBiProcessrouteM
|
||||
public void submit(JSONObject whereJson) {
|
||||
this.update(new UpdateWrapper<PdmBiProcessroute>()
|
||||
.set("processroute_status","20")
|
||||
.set("update_optid",SecurityUtils.getCurrentUserId())
|
||||
.set("update_optname",SecurityUtils.getCurrentNickName())
|
||||
.set("update_id",SecurityUtils.getCurrentUserId())
|
||||
.set("update_name",SecurityUtils.getCurrentNickName())
|
||||
.set("update_time",DateUtil.now())
|
||||
.set("audit_id",SecurityUtils.getCurrentUserId())
|
||||
.set("audit_name",SecurityUtils.getCurrentNickName())
|
||||
|
||||
@@ -69,12 +69,12 @@ public class PdmBiProductprocessroute implements Serializable {
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optid;
|
||||
private String update_id;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String update_optname;
|
||||
private String update_name;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
@@ -84,12 +84,12 @@ public class PdmBiProductprocessroute implements Serializable {
|
||||
/**
|
||||
* 审核人
|
||||
*/
|
||||
private String audit_optid;
|
||||
private String audit_id;
|
||||
|
||||
/**
|
||||
* 审核人姓名
|
||||
*/
|
||||
private String audit_optname;
|
||||
private String audit_name;
|
||||
|
||||
/**
|
||||
* 审核时间
|
||||
|
||||
@@ -151,7 +151,7 @@ public class PdmBiProductprocessrouteServiceImpl extends ServiceImpl<PdmBiProduc
|
||||
throw new BadRequestException("该系列已经存在工艺路线!");
|
||||
}
|
||||
|
||||
this.update(new UpdateWrapper<PdmBiProductprocessroute>().set("remark", jo.getString("remark")).set("class_id", jo.getString("class_id")).set("detail_count", rows.size()).set("update_optid", SecurityUtils.getCurrentUserId()).set("update_optname", SecurityUtils.getCurrentNickName()).set("update_time", DateUtil.now()).eq("productprocess_id", jo.getString("productprocess_id")));
|
||||
this.update(new UpdateWrapper<PdmBiProductprocessroute>().set("remark", jo.getString("remark")).set("class_id", jo.getString("class_id")).set("detail_count", rows.size()).set("update_id", SecurityUtils.getCurrentUserId()).set("update_name", SecurityUtils.getCurrentNickName()).set("update_time", DateUtil.now()).eq("productprocess_id", jo.getString("productprocess_id")));
|
||||
productprocessroutedtlService.remove(new QueryWrapper<PdmBiProductprocessroutedtl>().eq("productprocess_id", jo.getString("productprocess_id")));
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
@@ -164,7 +164,7 @@ public class PdmBiProductprocessrouteServiceImpl extends ServiceImpl<PdmBiProduc
|
||||
|
||||
@Override
|
||||
public void deleteAll(Long[] ids) {
|
||||
this.update(new UpdateWrapper<PdmBiProductprocessroute>().set("is_delete", "1").set("update_optid", SecurityUtils.getCurrentUserId()).set("update_optname", SecurityUtils.getCurrentNickName()).set("update_time", DateUtil.now()).in("productprocess_id", ids));
|
||||
this.update(new UpdateWrapper<PdmBiProductprocessroute>().set("is_delete", "1").set("update_id", SecurityUtils.getCurrentUserId()).set("update_name", SecurityUtils.getCurrentNickName()).set("update_time", DateUtil.now()).in("productprocess_id", ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -185,12 +185,12 @@ public class PdmBiProductprocessrouteServiceImpl extends ServiceImpl<PdmBiProduc
|
||||
|
||||
@Override
|
||||
public void submit(JSONObject whereJson) {
|
||||
this.update(new UpdateWrapper<PdmBiProductprocessroute>().set("productprocess_status", "20").set("update_optid", SecurityUtils.getCurrentUserId()).set("update_optname", SecurityUtils.getCurrentNickName()).set("update_time", DateUtil.now()).set("audit_optid", SecurityUtils.getCurrentUserId()).set("audit_optname", SecurityUtils.getCurrentNickName()).set("audit_time", DateUtil.now()).eq("processroute_id", whereJson.getString("processroute_id")));
|
||||
this.update(new UpdateWrapper<PdmBiProductprocessroute>().set("productprocess_status", "20").set("update_id", SecurityUtils.getCurrentUserId()).set("update_name", SecurityUtils.getCurrentNickName()).set("update_time", DateUtil.now()).set("audit_id", SecurityUtils.getCurrentUserId()).set("audit_name", SecurityUtils.getCurrentNickName()).set("audit_time", DateUtil.now()).eq("processroute_id", whereJson.getString("processroute_id")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unSubmit(JSONObject whereJson) {
|
||||
this.update(new UpdateWrapper<PdmBiProductprocessroute>().set("productprocess_status", "10").set("update_optid", SecurityUtils.getCurrentUserId()).set("update_optname", SecurityUtils.getCurrentNickName()).set("update_time", DateUtil.now()).set("audit_optid", " ").set("audit_optname", " ").set("audit_time", " ").eq("processroute_id", whereJson.getString("processroute_id")));
|
||||
this.update(new UpdateWrapper<PdmBiProductprocessroute>().set("productprocess_status", "10").set("update_id", SecurityUtils.getCurrentUserId()).set("update_name", SecurityUtils.getCurrentNickName()).set("update_time", DateUtil.now()).set("audit_id", " ").set("audit_name", " ").set("audit_time", " ").eq("processroute_id", whereJson.getString("processroute_id")));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,7 +13,9 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -106,4 +108,14 @@ public class BomController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
*导入bom数据
|
||||
*/
|
||||
@Log("导入bom数据")
|
||||
@PostMapping("/excelImport")
|
||||
public ResponseEntity<Object> excelImport(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
|
||||
bomService.excelImport(file,request);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.product_manage.备份pdm.service.dto.BomDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -33,10 +35,10 @@ public interface BomService {
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param bom_uuid ID
|
||||
* @param bom_id ID
|
||||
* @return Bom
|
||||
*/
|
||||
BomDto findById(String bom_uuid);
|
||||
BomDto findById(String bom_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
@@ -73,4 +75,12 @@ public interface BomService {
|
||||
void submits(JSONObject param);
|
||||
|
||||
void cancelSubmit(JSONObject param);
|
||||
|
||||
|
||||
/**
|
||||
* excel导入
|
||||
* @param file
|
||||
* @param request
|
||||
*/
|
||||
void excelImport(MultipartFile file, HttpServletRequest request);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.math.BigDecimal;
|
||||
public class BomDto implements Serializable {
|
||||
|
||||
/** BOM单标识 */
|
||||
private String bom_uuid;
|
||||
private String bom_id;
|
||||
|
||||
/** BOM单编码 */
|
||||
private String bom_code;
|
||||
@@ -24,10 +24,10 @@ public class BomDto implements Serializable {
|
||||
private String bom_name;
|
||||
|
||||
/** 物料标识 */
|
||||
private String material_uuid;
|
||||
private String material_id;
|
||||
|
||||
/** 产品工艺路线标识 */
|
||||
private String processroute_uuid;
|
||||
private String processroute_id;
|
||||
|
||||
/** 成材率百分比 */
|
||||
private BigDecimal yield_rate;
|
||||
|
||||
@@ -55,10 +55,10 @@ public class ProcessrouteDto implements Serializable {
|
||||
private String update_time;
|
||||
|
||||
/** 审核人 */
|
||||
private Long audit_optid;
|
||||
private Long audit_id;
|
||||
|
||||
/** 审核人姓名 */
|
||||
private String audit_optname;
|
||||
private String audit_name;
|
||||
|
||||
/** 审核时间 */
|
||||
private String audit_time;
|
||||
|
||||
@@ -57,10 +57,10 @@ public class ProductprocessrouteDto implements Serializable {
|
||||
private String update_time;
|
||||
|
||||
/** 审核人 */
|
||||
private Long audit_optid;
|
||||
private Long audit_id;
|
||||
|
||||
/** 审核人姓名 */
|
||||
private String audit_optname;
|
||||
private String audit_name;
|
||||
|
||||
/** 审核时间 */
|
||||
private String audit_time;
|
||||
|
||||
@@ -7,24 +7,34 @@ 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 cn.hutool.poi.excel.ExcelReader;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.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.WqlUtil;
|
||||
import org.nl.wms.product_manage.备份pdm.service.BomService;
|
||||
import org.nl.wms.product_manage.备份pdm.service.dto.BomDto;
|
||||
|
||||
import org.nl.wms.system_manage.service.user.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
@@ -36,14 +46,18 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
public class BomServiceImpl implements BomService {
|
||||
|
||||
@Autowired
|
||||
ISysUserService userService;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(Map whereJson, Pageable page){
|
||||
String material = MapUtil.getStr(whereJson, "material");
|
||||
String bom = MapUtil.getStr(whereJson, "bom");
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "1");
|
||||
if (StrUtil.isNotEmpty(material)) map.put("material", "%" + material + "%");
|
||||
if (StrUtil.isNotEmpty(bom)) map.put("bom", "%" + bom + "%");
|
||||
if (StrUtil.isNotEmpty(material))
|
||||
{map.put("material", "%" + material + "%");}
|
||||
if (StrUtil.isNotEmpty(bom)) {map.put("bom", "%" + bom + "%");}
|
||||
JSONObject json = WQL.getWO("PDM_BI_BOM01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "bom.update_time desc");
|
||||
return json;
|
||||
}
|
||||
@@ -52,14 +66,14 @@ public class BomServiceImpl implements BomService {
|
||||
public List<BomDto> queryAll(Map whereJson){
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_bom");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(BomDto.class);
|
||||
if (ObjectUtil.isNotEmpty(arr)) {return arr.toJavaList(BomDto.class);}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BomDto findById(String bom_uuid) {
|
||||
public BomDto findById(String bom_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_bom");
|
||||
JSONObject json = wo.query("bom_uuid = '" + bom_uuid + "'").uniqueResult(0);
|
||||
JSONObject json = wo.query("bom_id = '" + bom_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
return json.toJavaObject( BomDto.class);
|
||||
}
|
||||
@@ -82,33 +96,33 @@ public class BomServiceImpl implements BomService {
|
||||
WQLObject wo_bom = WQLObject.getWQLObject("pdm_bi_bom");
|
||||
WQLObject wo_bomdtl = WQLObject.getWQLObject("PDM_BI_BOMDtl");
|
||||
final JSONArray jsonArray = param.getJSONArray("tableData");
|
||||
final String material_uuid = param.getString("material_uuid");
|
||||
final JSONObject jsonObject1 = wo_bom.query("material_uuid = '" + material_uuid + "'").uniqueResult(0);
|
||||
final String material_id = param.getString("material_id");
|
||||
final JSONObject jsonObject1 = wo_bom.query("material_id = '" + material_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonObject1)){
|
||||
throw new BadRequestException("物料已经存在,请重新选择");
|
||||
}
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
String bom_uuid = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
param.put("bom_uuid",bom_uuid);
|
||||
String bom_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
param.put("bom_id",bom_id);
|
||||
param.put("bom_status","01");
|
||||
param.put("detail_count",jsonArray.size());
|
||||
param.put("create_id",currentUserId);
|
||||
param.put("create_name",nickName);
|
||||
param.put("create_time",DateUtil.now());
|
||||
param.put("update_optid",currentUserId);
|
||||
param.put("update_optname",nickName);
|
||||
param.put("update_id",currentUserId);
|
||||
param.put("update_name",nickName);
|
||||
param.put("update_time",DateUtil.now());
|
||||
wo_bom.insert(param);
|
||||
if (jsonArray.size() > 0) {
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject map = new JSONObject();
|
||||
final JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
map.put("bomdtl_uuid",IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||
map.put("bom_uuid",bom_uuid);
|
||||
map.put("workprocedure_uuid",jsonObject.getString("workprocedure_uuid"));
|
||||
map.put("material_uuid",jsonObject.getString("material_uuid"));
|
||||
map.put("bomdtl_id",IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||
map.put("bom_id",bom_id);
|
||||
map.put("workprocedure_id",jsonObject.getString("workprocedure_id"));
|
||||
map.put("material_id",jsonObject.getString("material_id"));
|
||||
map.put("yield_rate",jsonObject.getString("yield_rate"));
|
||||
map.put("endproduct_rate",jsonObject.getString("endproduct_rate"));
|
||||
map.put("piece_weight",jsonObject.getString("piece_weight"));
|
||||
@@ -129,15 +143,15 @@ public class BomServiceImpl implements BomService {
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
param.put("detail_count",jsonArray.size());
|
||||
param.put("update_optid",currentUserId);
|
||||
param.put("update_optname",nickName);
|
||||
param.put("update_id",currentUserId);
|
||||
param.put("update_name",nickName);
|
||||
param.put("update_time",DateUtil.now());
|
||||
wo_bom.update(param);
|
||||
if (jsonArray.size() > 0) {
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject map = new JSONObject();
|
||||
final JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
map.put("bomdtl_uuid",jsonObject.getString("bomdtl_uuid"));
|
||||
map.put("bomdtl_id",jsonObject.getString("bomdtl_id"));
|
||||
map.put("yield_rate",jsonObject.getString("yield_rate"));
|
||||
map.put("endproduct_rate",jsonObject.getString("endproduct_rate"));
|
||||
map.put("piece_weight",jsonObject.getString("piece_weight"));
|
||||
@@ -151,30 +165,30 @@ public class BomServiceImpl implements BomService {
|
||||
public void deleteAll(String[] ids) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_bom");
|
||||
WQLObject wo_dtl = WQLObject.getWQLObject("PDM_BI_BOMDtl");
|
||||
for (String bom_uuid: ids) {
|
||||
wo.delete("bom_uuid = '"+bom_uuid+"'");
|
||||
wo_dtl.delete("bom_uuid = '"+bom_uuid+"'");
|
||||
for (String bom_id: ids) {
|
||||
wo.delete("bom_id = '"+bom_id+"'");
|
||||
wo_dtl.delete("bom_id = '"+bom_id+"'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getProduceProcessRouteByMaterialId(JSONObject param) {
|
||||
WQLObject wo = WQLObject.getWQLObject("PDM_BI_ProductProcessRoute");
|
||||
final JSONObject jsonObject = wo.query("is_delete = '0' and productprocess_status = '20' and material_id = '" + param.getString("material_uuid") + "'").uniqueResult(0);
|
||||
final JSONObject jsonObject = wo.query("is_delete = '0' and productprocess_status = '20' and material_id = '" + param.getString("material_id") + "'").uniqueResult(0);
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getworkprocedureListByProduceProcessRouteId(JSONObject param) {
|
||||
JSONObject json = new JSONObject();
|
||||
final String material_uuid = param.getString("material_uuid");
|
||||
final String material_id = param.getString("material_id");
|
||||
WQLObject wo_endrealsemimaterial = WQLObject.getWQLObject("md_me_endrealsemimaterial");
|
||||
WQLObject wo_material = WQLObject.getWQLObject("md_me_materialbase");
|
||||
final JSONObject jsonEndrealsemimaterial = wo_endrealsemimaterial.query("end_material_id = '" + material_uuid + "'").uniqueResult(0);
|
||||
final JSONObject jsonEndrealsemimaterial = wo_endrealsemimaterial.query("end_material_id = '" + material_id + "'").uniqueResult(0);
|
||||
final JSONObject semi_material = wo_material.query("is_delete = '0' and material_id = '" + jsonEndrealsemimaterial.getString("semi_material_id") + "'").uniqueResult(0);
|
||||
WQLObject wo = WQLObject.getWQLObject("PDM_BI_ProductProcessRouteDtl");
|
||||
WQLObject wo_workprocedure = WQLObject.getWQLObject("pdm_bi_workprocedure");
|
||||
final JSONArray resultJSONArray = wo.query("productprocess_id = '" + param.getString("processroute_uuid") + "'","workprocedure_no").getResultJSONArray(0);
|
||||
final JSONArray resultJSONArray = wo.query("productprocess_id = '" + param.getString("processroute_id") + "'","workprocedure_no").getResultJSONArray(0);
|
||||
JSONArray newJ = new JSONArray();
|
||||
for (int i = 0; i < resultJSONArray.size(); i++) {
|
||||
JSONObject jsonObject = resultJSONArray.getJSONObject(i);
|
||||
@@ -190,10 +204,10 @@ public class BomServiceImpl implements BomService {
|
||||
|
||||
@Override
|
||||
public JSONArray getDtl(JSONObject param) {
|
||||
final String bom_uuid = param.getString("bom_uuid");
|
||||
final String bom_id = param.getString("bom_id");
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag","2");
|
||||
map.put("bom_uuid",bom_uuid);
|
||||
map.put("bom_id",bom_id);
|
||||
JSONArray json = WQL.getWO("PDM_BI_BOM01").addParamMap(map).process().getResultJSONArray(0);
|
||||
return json;
|
||||
}
|
||||
@@ -205,12 +219,12 @@ public class BomServiceImpl implements BomService {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
final String bom_uuid = param.getString("bom_uuid");
|
||||
final String bom_id = param.getString("bom_id");
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("bom_uuid",bom_uuid);
|
||||
map.put("bom_id",bom_id);
|
||||
map.put("bom_status","02");
|
||||
map.put("update_optid",currentUserId);
|
||||
map.put("update_optname",nickName);
|
||||
map.put("update_id",currentUserId);
|
||||
map.put("update_name",nickName);
|
||||
map.put("update_time",DateUtil.now());
|
||||
wo_bom.update(map);
|
||||
}
|
||||
@@ -222,14 +236,253 @@ public class BomServiceImpl implements BomService {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
final String bom_uuid = param.getString("bom_uuid");
|
||||
final String bom_id = param.getString("bom_id");
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("bom_uuid",bom_uuid);
|
||||
map.put("bom_id",bom_id);
|
||||
map.put("bom_status","01");
|
||||
map.put("update_optid",currentUserId);
|
||||
map.put("update_optname",nickName);
|
||||
map.put("update_id",currentUserId);
|
||||
map.put("update_name",nickName);
|
||||
map.put("update_time",DateUtil.now());
|
||||
wo_bom.update(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void excelImport(MultipartFile file, HttpServletRequest request) {
|
||||
if(file.isEmpty()) {
|
||||
throw new BadRequestException("文件为空,请添加数据后重新导入");
|
||||
}
|
||||
try(InputStream inputStream = file.getInputStream()) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
//Bom主表
|
||||
WQLObject wo_pdm_bi_bom = WQLObject.getWQLObject("pdm_bi_bom");
|
||||
//Bom明细表
|
||||
WQLObject wo_pdm_bomdtl_aps = WQLObject.getWQLObject("pdm_bi_bomdtl_aps");
|
||||
//物料表
|
||||
WQLObject wo_material = WQLObject.getWQLObject("md_me_materialbase");
|
||||
//原材料对应半成品
|
||||
WQLObject wo_semirealrawmaterial = WQLObject.getWQLObject("md_me_semirealrawmaterial");
|
||||
//设备表
|
||||
WQLObject wo_device = WQLObject.getWQLObject("pdm_bi_device");
|
||||
//工序表
|
||||
WQLObject wo_workprocedure = WQLObject.getWQLObject("pdm_bi_workprocedure");
|
||||
//工艺路线
|
||||
WQLObject wo_processroute = WQLObject.getWQLObject("pdm_bi_processroute");
|
||||
ExcelReader excelReader = ExcelUtil.getReader(inputStream, 0);
|
||||
List<List<Object>> read = excelReader.read(0, excelReader.getRowCount());
|
||||
Map<String,String> errorMap = new HashMap();
|
||||
boolean isCreateBom = true;
|
||||
// 循环获取的数据
|
||||
row:
|
||||
for(int i = 1; i < read.size(); i++) {
|
||||
List<Object> list = read.get(i);
|
||||
if(ObjectUtil.isEmpty(list)) {
|
||||
continue;
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
//循环每一行
|
||||
col:
|
||||
for(int j = 0; j < list.size(); j++) {
|
||||
String col = null == list.get(j) ? "" : String.valueOf(list.get(j));
|
||||
if(j == 0) {
|
||||
if(StringUtils.isBlank(col)) {
|
||||
throw new BadRequestException("物料编号不能为空!");
|
||||
}
|
||||
JSONObject jsonMaterial = wo_material.query("is_delete = '0' and material_code = '" + col + "'").uniqueResult(0);
|
||||
if(ObjectUtil.isEmpty(jsonMaterial)) {
|
||||
errorMap.put("第" + i + "行" + col, "物料规格对应物料信息不存在");
|
||||
}
|
||||
else{
|
||||
JSONObject jsonBom = wo_pdm_bi_bom.query("material_id = '" + jsonMaterial.getString("material_id") + "'").uniqueResult(0);
|
||||
if(!ObjectUtil.isEmpty(jsonBom)) {
|
||||
param.put("bom_id", jsonBom.getString("bom_id"));
|
||||
isCreateBom = false;
|
||||
}
|
||||
else{
|
||||
param.put("bom_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
param.put("bom_code", "BOM" + jsonMaterial.getString("material_spec"));
|
||||
isCreateBom = true;
|
||||
}
|
||||
param.put("material_code", col);
|
||||
param.put("material_id", jsonMaterial.getString("material_id"));
|
||||
param.put("material_spec", jsonMaterial.getString("material_spec"));
|
||||
param.put("bom_name", jsonMaterial.getString("material_spec"));
|
||||
}
|
||||
}
|
||||
if(j == 3) {
|
||||
//数量计量单位名称
|
||||
param.put("qty_unit_name", col);
|
||||
}
|
||||
if(j == 4) {
|
||||
//工艺路线代码
|
||||
if(StringUtils.isBlank(col)) {
|
||||
throw new BadRequestException("工艺路线代码不能为空");
|
||||
}
|
||||
JSONObject jsonProcessroute = wo_processroute.query("is_delete = '0' and processroute_code = '" + col + "'").uniqueResult(0);
|
||||
if(ObjectUtil.isEmpty(jsonProcessroute)) {
|
||||
errorMap.put("第" + i + "行" + col, "工艺路线信息不存在");
|
||||
}
|
||||
else{
|
||||
param.put("processroute_id", jsonProcessroute.getString("processroute_id"));
|
||||
param.put("processroute_name", jsonProcessroute.getString("processroute_name"));
|
||||
}
|
||||
param.put("processroute_code", col);
|
||||
}
|
||||
// if(j == 6) {
|
||||
// //成材率
|
||||
// if(StringUtils.isBlank(col)) {
|
||||
// throw new BadRequestException("成材率不能为空");
|
||||
// }
|
||||
// param.put("yield_rate", col);
|
||||
// }
|
||||
// if(j == 7) {
|
||||
// //合格率
|
||||
// if(StringUtils.isBlank(col)) {
|
||||
// throw new BadRequestException("合格率不能为空");
|
||||
// }
|
||||
// param.put("endproduct_rate", col);
|
||||
// }
|
||||
if(j == 8) {
|
||||
//产能
|
||||
if(StringUtils.isBlank(col)) {
|
||||
param.put("manufacture", "0");
|
||||
}
|
||||
else{
|
||||
param.put("manufacture", col + "ph");
|
||||
}
|
||||
}
|
||||
if(j == 9) {
|
||||
//产品单重
|
||||
param.put("piece_weight", col);
|
||||
}
|
||||
if(j == 10) {
|
||||
//工序编号
|
||||
if(StringUtils.isBlank(col)) {
|
||||
throw new BadRequestException("工序编号不能为空");
|
||||
}
|
||||
//绕过仓储工序
|
||||
if(col.contains("A1_CC")) {
|
||||
break;
|
||||
}
|
||||
//判断是否前段工序
|
||||
if(col.contains("A1_SKQX") || col.contains("A1_KZ") || col.contains("A1_BZ") || col.contains("A1_MP")) {
|
||||
param.put("is_front", "0");
|
||||
}
|
||||
else{
|
||||
param.put("is_front", "1");
|
||||
}
|
||||
JSONObject jsonWorkprocedure = wo_workprocedure.query("is_used = '1' and workprocedure_code = '" + col + "'").uniqueResult(0);
|
||||
if(ObjectUtil.isEmpty(jsonWorkprocedure)) {
|
||||
errorMap.put("请检查第" + i + "行" + col , "所匹配的工序信息不存在!");
|
||||
}
|
||||
else{
|
||||
param.put("workprocedure_id", jsonWorkprocedure.getString("workprocedure_id"));
|
||||
param.put("workprocedure_name", jsonWorkprocedure.getString("workprocedure_name"));
|
||||
}
|
||||
}
|
||||
if(j == 12) {
|
||||
if(!StringUtils.isBlank(col)) {
|
||||
//工序顺序号
|
||||
param.put("workprocedure_no", col);
|
||||
JSONObject bomDtlParam = new JSONObject();
|
||||
param.put("yield_rate", "0");
|
||||
param.put("endproduct_rate", "1");
|
||||
bomDtlParam.put("bomdtl_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
bomDtlParam.put("bom_id", param.getString("bom_id"));
|
||||
bomDtlParam.put("material_id", param.getString("material_id"));
|
||||
bomDtlParam.put("material_code", param.getString("material_code"));
|
||||
bomDtlParam.put("material_spec", param.getString("material_spec"));
|
||||
bomDtlParam.put("piece_weight", param.getString("piece_weight"));
|
||||
bomDtlParam.put("qty_unit_name", param.getString("qty_unit_name"));
|
||||
bomDtlParam.put("processroute_id", param.getString("processroute_id"));
|
||||
bomDtlParam.put("workprocedure_id", param.getString("workprocedure_id"));
|
||||
bomDtlParam.put("workprocedure_no", param.getString("workprocedure_no"));
|
||||
bomDtlParam.put("workprocedure_name", param.getString("workprocedure_name"));
|
||||
bomDtlParam.put("connection_method", "ES");
|
||||
bomDtlParam.put("is_front", param.getString("is_front"));
|
||||
bomDtlParam.put("bom_status", "01");
|
||||
bomDtlParam.put("create_id", currentUserId);
|
||||
bomDtlParam.put("create_name", nickName);
|
||||
bomDtlParam.put("create_time", DateUtil.now());
|
||||
bomDtlParam.put("manufacture", param.getString("manufacture"));
|
||||
bomDtlParam.put("instruction_type", "I");
|
||||
bomDtlParam.put("instruction_code", "In0");
|
||||
bomDtlParam.put("yield_rate", param.getString("yield_rate"));
|
||||
bomDtlParam.put("endproduct_rate", param.getString("endproduct_rate"));
|
||||
if("10".equals(col)) {
|
||||
bomDtlParam.put("instruction_code", "In");
|
||||
JSONObject rawmaterialJson = wo_semirealrawmaterial.query("semi_material_id = '" + param.getString("material_id") + "'").uniqueResult(0);
|
||||
if(!ObjectUtil.isEmpty(rawmaterialJson)) {
|
||||
bomDtlParam.put("resources", rawmaterialJson.getString("raw_material_code"));
|
||||
bomDtlParam.put("manufacture", rawmaterialJson.getString("rate_qty"));
|
||||
}
|
||||
else{
|
||||
bomDtlParam.put("resources", "0");
|
||||
bomDtlParam.put("manufacture", "0");
|
||||
}
|
||||
}
|
||||
else{
|
||||
//后段暂无产能
|
||||
int no = Integer.parseInt(col) - 10;
|
||||
bomDtlParam.put("resources", param.getString("material_code") + "-" + no);
|
||||
bomDtlParam.put("manufacture", "");
|
||||
}
|
||||
//插入原材料明细
|
||||
wo_pdm_bomdtl_aps.insert(bomDtlParam);
|
||||
}
|
||||
}
|
||||
if(j == 13) {
|
||||
//插入设备明细
|
||||
JSONArray deviceList = wo_device.query("is_delete = '0' and product_area = 'A1' and workprocedure_id = '" + param.getString("workprocedure_id") + "'").getResultJSONArray(0);
|
||||
JSONObject bomDtlParam = new JSONObject();
|
||||
for(int d = 0; d < deviceList.size(); d++) {
|
||||
JSONObject device = deviceList.getJSONObject(d);
|
||||
bomDtlParam.put("resources", device.getString("device_code"));
|
||||
bomDtlParam.put("bomdtl_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
bomDtlParam.put("bom_id", param.getString("bom_id"));
|
||||
bomDtlParam.put("material_id", param.getString("material_id"));
|
||||
bomDtlParam.put("material_code", param.getString("material_code"));
|
||||
bomDtlParam.put("material_spec", param.getString("material_spec"));
|
||||
bomDtlParam.put("qty_unit_name", param.getString("qty_unit_name"));
|
||||
bomDtlParam.put("processroute_id", param.getString("processroute_id"));
|
||||
bomDtlParam.put("workprocedure_id", param.getString("workprocedure_id"));
|
||||
bomDtlParam.put("workprocedure_no", param.getString("workprocedure_no"));
|
||||
bomDtlParam.put("workprocedure_name", param.getString("workprocedure_name"));
|
||||
bomDtlParam.put("is_front", param.getString("is_front"));
|
||||
bomDtlParam.put("piece_weight", param.getString("piece_weight"));
|
||||
bomDtlParam.put("connection_method", "ES");
|
||||
bomDtlParam.put("bom_status", "01");
|
||||
bomDtlParam.put("create_id", currentUserId);
|
||||
bomDtlParam.put("create_name", nickName);
|
||||
bomDtlParam.put("create_time", DateUtil.now());
|
||||
bomDtlParam.put("manufacture", param.getString("manufacture"));
|
||||
bomDtlParam.put("instruction_type", "U");
|
||||
bomDtlParam.put("instruction_code", "M");
|
||||
//插入明细表
|
||||
wo_pdm_bomdtl_aps.insert(bomDtlParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
param.put("bom_status", "01");
|
||||
param.put("create_mode", "03");
|
||||
param.put("create_id", currentUserId);
|
||||
param.put("create_name", nickName);
|
||||
param.put("create_time", DateUtil.now());
|
||||
if(isCreateBom) {
|
||||
//插入主表
|
||||
wo_pdm_bi_bom.insert(param);
|
||||
}
|
||||
if(!CollectionUtils.isEmpty(errorMap)) {
|
||||
throw new BadRequestException(JSON.toJSONString(errorMap));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -224,8 +224,8 @@ public class FactoryCalendarServiceImpl implements FactoryCalendarService{
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("factorycalendar_id", String.valueOf(factorycalendar_id));
|
||||
param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_id", currentUserId);
|
||||
param.put("update_name", nickName);
|
||||
param.put("update_time", DateUtil.now());
|
||||
wo.update(param);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
输入.flag TYPEAS s_string
|
||||
输入.bom TYPEAS s_string
|
||||
输入.material TYPEAS s_string
|
||||
输入.bom_uuid TYPEAS s_string
|
||||
输入.bom_id TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
@@ -50,8 +50,8 @@
|
||||
material.material_spec
|
||||
FROM
|
||||
PDM_BI_BOM bom
|
||||
left join md_me_materialbase material on bom.material_uuid = material.material_id
|
||||
left join PDM_BI_ProductProcessRoute productProcessRoute on bom.processroute_uuid = productProcessRoute.productprocess_id
|
||||
left join md_me_materialbase material on bom.material_id = material.material_id
|
||||
left join PDM_BI_ProductProcessRoute productProcessRoute on bom.processroute_id = productProcessRoute.productprocess_id
|
||||
WHERE
|
||||
1 = 1
|
||||
OPTION 输入.material <> ""
|
||||
@@ -77,10 +77,10 @@
|
||||
material.material_name
|
||||
FROM
|
||||
PDM_BI_BOMDtl dtl
|
||||
LEFT JOIN pdm_bi_workprocedure workprocedure ON dtl.workprocedure_uuid = workprocedure.workprocedure_id
|
||||
LEFT JOIN md_me_materialbase material ON dtl.material_uuid = material.material_id
|
||||
LEFT JOIN pdm_bi_workprocedure workprocedure ON dtl.workprocedure_id = workprocedure.workprocedure_id
|
||||
LEFT JOIN md_me_materialbase material ON dtl.material_id = material.material_id
|
||||
where
|
||||
dtl.bom_uuid = 输入.bom_uuid
|
||||
dtl.bom_id = 输入.bom_id
|
||||
order by
|
||||
dtl.seq_no
|
||||
ENDSELECT
|
||||
|
||||
Binary file not shown.
@@ -64,4 +64,12 @@ export function cancelSubmit(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, cancelSubmit, submits, getDtl, getProduceProcessRouteByMaterialId, getworkprocedureListByProduceProcessRouteId }
|
||||
export function excelImport(data) {
|
||||
return request({
|
||||
url: 'api/bom/excelImport',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, cancelSubmit, submits, getDtl, getProduceProcessRouteByMaterialId, getworkprocedureListByProduceProcessRouteId, excelImport }
|
||||
|
||||
@@ -5,9 +5,16 @@
|
||||
<div class="head-container">
|
||||
<!-- 搜索 -->
|
||||
<label class="el-form-item-label">模糊搜索</label>
|
||||
<el-input v-model="query.search" clearable size="small" placeholder="输入编码或者名称" style="width: 200px;"
|
||||
class="filter-item" @keyup.enter.native="crud.toQuery"/>
|
||||
<rrOperation/>
|
||||
<el-input
|
||||
v-model="query.search"
|
||||
clearable
|
||||
size="small"
|
||||
placeholder="输入编码或者名称"
|
||||
style="width: 200px;"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
<rrOperation />
|
||||
</div>
|
||||
|
||||
<el-dialog
|
||||
@@ -32,7 +39,7 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="所需原料(g)" prop="rate_qty">
|
||||
<el-input-number v-model.number="form.rate_qty" style="width: 280px;"/>
|
||||
<el-input-number v-model.number="form.rate_qty" style="width: 280px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -80,16 +87,16 @@
|
||||
:header-cell-style="{'text-align':'center'}"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column prop="workprocedure_name" label="工序名称" :min-width="100" show-overflow-tooltip/>
|
||||
<el-table-column prop="material_code" label="半成品编码" :min-width="100" show-overflow-tooltip/>
|
||||
<el-table-column prop="material_name" label="半成品名称" :min-width="180" show-overflow-tooltip/>
|
||||
<el-table-column prop="material_spec" label="半成品规格" :min-width="150" show-overflow-tooltip/>
|
||||
<el-table-column prop="class_name" label="半成品系列" :min-width="100" show-overflow-tooltip/>
|
||||
<el-table-column prop="ymaterial_code" label="对应原材料编码" :min-width="120" show-overflow-tooltip/>
|
||||
<el-table-column prop="ymaterial_name" label="对应原材料名称" :min-width="180" show-overflow-tooltip/>
|
||||
<el-table-column prop="ymaterial_spec" label="对应原材料规格" :min-width="180" show-overflow-tooltip/>
|
||||
<el-table-column prop="yclass_name" label="对应原材料系列" :min-width="120" show-overflow-tooltip/>
|
||||
<el-table-column prop="rate_qty" label="所需原料(g)" :min-width="120" show-overflow-tooltip/>
|
||||
<el-table-column prop="workprocedure_name" label="工序名称" :min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="material_code" label="半成品编码" :min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="material_name" label="半成品名称" :min-width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="material_spec" label="半成品规格" :min-width="150" show-overflow-tooltip />
|
||||
<el-table-column prop="class_name" label="半成品系列" :min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="ymaterial_code" label="对应原材料编码" :min-width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="ymaterial_name" label="对应原材料名称" :min-width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="ymaterial_spec" label="对应原材料规格" :min-width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="yclass_name" label="对应原材料系列" :min-width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="rate_qty" label="所需原料(g)" :min-width="120" show-overflow-tooltip />
|
||||
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="addMaterial(scope.row)">扩展属性维护</el-button>
|
||||
@@ -97,16 +104,19 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination/>
|
||||
<SelectRawMaterialDialog ref="selectRawMaterialDialog" :dialog-show.sync="selectRawMaterialDialog"
|
||||
@tableChanged3="tableChanged3"/>
|
||||
<UploadDialog :dialog-show.sync="uploadShow" @tableChanged3="crud.toQuery()"/>
|
||||
<pagination />
|
||||
<SelectRawMaterialDialog
|
||||
ref="selectRawMaterialDialog"
|
||||
:dialog-show.sync="selectRawMaterialDialog"
|
||||
@tableChanged3="tableChanged3"
|
||||
/>
|
||||
<UploadDialog :dialog-show.sync="uploadShow" @tableChanged3="crud.toQuery()" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudSemirealrawmaterial from '@/api/wms/basedata/master/semirealrawmaterial'
|
||||
import CRUD, {presenter, header, form, crud} from '@crud/crud'
|
||||
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
@@ -121,14 +131,14 @@ const defaultForm = {
|
||||
create_id: null,
|
||||
create_name: null,
|
||||
create_time: null,
|
||||
update_optid: null,
|
||||
update_optname: null,
|
||||
update_id: null,
|
||||
update_name: null,
|
||||
update_time: null
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'Semirealrawmaterial',
|
||||
components: {UploadDialog, pagination, crudOperation, rrOperation, SelectRawMaterialDialog},
|
||||
components: { UploadDialog, pagination, crudOperation, rrOperation, SelectRawMaterialDialog },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
@@ -140,7 +150,7 @@ export default {
|
||||
download: false,
|
||||
reset: false
|
||||
},
|
||||
crudMethod: {...crudSemirealrawmaterial}
|
||||
crudMethod: { ...crudSemirealrawmaterial }
|
||||
})
|
||||
},
|
||||
data() {
|
||||
|
||||
115
mes/qd/src/views/wms/pdm/base/bom/UploadDialog.vue
Normal file
115
mes/qd/src/views/wms/pdm/base/bom/UploadDialog.vue
Normal file
@@ -0,0 +1,115 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="导入Excel文件"
|
||||
append-to-body
|
||||
:visible.sync="dialogVisible"
|
||||
destroy-on-close
|
||||
width="400px"
|
||||
:show-close="true"
|
||||
@close="close"
|
||||
@open="open"
|
||||
>
|
||||
<el-upload
|
||||
ref="upload"
|
||||
class="upload-demo"
|
||||
action=""
|
||||
drag
|
||||
:on-exceed="is_one"
|
||||
:limit="1"
|
||||
:auto-upload="false"
|
||||
:multiple="false"
|
||||
:show-file-list="true"
|
||||
:on-change="uploadByJsqd"
|
||||
:file-list="fileList"
|
||||
accept=".xlsx,.xls"
|
||||
>
|
||||
<i class="el-icon-upload" />
|
||||
<div class="el-upload__text">
|
||||
将文件拖到此处,或
|
||||
<em>点击上传</em>
|
||||
</div>
|
||||
<div slot="tip" class="el-upload__tip">只能上传Excel文件,且不超过10MB</div>
|
||||
</el-upload>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudBom from '@/api/wms/pdm/bom'
|
||||
import CRUD, { crud } from '@crud/crud'
|
||||
export default {
|
||||
name: 'UploadDialog',
|
||||
mixins: [crud()],
|
||||
components: {},
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
openParam: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
fileList: [],
|
||||
file1: ''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue, oldValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
},
|
||||
openParam: {
|
||||
handler(newValue, oldValue) {
|
||||
this.opendtlParam = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
},
|
||||
close() {
|
||||
this.$emit('update:dialogShow', false)
|
||||
},
|
||||
is_one() {
|
||||
this.crud.notify('只能上传一个excel文件!', CRUD.NOTIFICATION_TYPE.WARNING)
|
||||
},
|
||||
// 文件校验方法
|
||||
beforeAvatarUpload(file) {
|
||||
// 不能导入大小超过2Mb的文件
|
||||
if (file.size > 10 * 1024 * 1024) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
},
|
||||
// 文件发生改变就会触发的事件
|
||||
uploadByJsqd(file) {
|
||||
this.file1 = file
|
||||
},
|
||||
submit() {
|
||||
if (this.beforeAvatarUpload(this.file1)) {
|
||||
this.fileList.name = this.file1.name
|
||||
this.fileList.url = ''
|
||||
var formdata = new FormData()
|
||||
formdata.append('file', this.file1.raw)
|
||||
// excelImport:请求接口 formdata:传递参数
|
||||
crudBom.excelImport(formdata).then((res) => {
|
||||
this.crud.notify('导入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.$emit('tableChanged3', '')
|
||||
this.$emit('update:dialogShow', false)
|
||||
})
|
||||
} else {
|
||||
this.crud.notify('文件过大,请上传小于10MB的文件〜', CRUD.NOTIFICATION_TYPE.WARNING)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -12,6 +12,16 @@
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="warning"
|
||||
icon="el-icon-upload2"
|
||||
size="mini"
|
||||
@click="uploadShow = true"
|
||||
>
|
||||
导入
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
@@ -43,23 +53,23 @@
|
||||
<el-link type="warning" @click="crud.toView(scope.row)">{{ scope.row.bom_code }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="bom_name" label="BOM单名称" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="material_code" label="物料编码" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="material_name" label="物料名称" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="material_spec" label="物料规格" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="processroute_uuid" label="产品工艺路线" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="yield_rate" label="成材率百分比" :formatter="rounding" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="endproduct_rate" label="成品率百分比" :formatter="rounding" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="bom_status" label="BOM单状态" min-width="110" show-overflow-tooltip >
|
||||
<el-table-column prop="bom_name" label="BOM单名称" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="material_code" label="物料编码" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="material_name" label="物料名称" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="material_spec" label="物料规格" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="processroute_uuid" label="产品工艺路线" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="yield_rate" label="成材率百分比" :formatter="rounding" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="endproduct_rate" label="成品率百分比" :formatter="rounding" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="bom_status" label="BOM单状态" min-width="110" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.BOM_STATUS[scope.row.bom_status] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="detail_count" label="明细数" />
|
||||
<el-table-column prop="remark" label="备注" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="remark" label="备注" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="create_name" label="创建人" />
|
||||
<el-table-column prop="create_time" label="创建时间" min-width="150" />
|
||||
<el-table-column prop="update_optname" label="修改人" />
|
||||
<el-table-column prop="update_optname" label="修改人" />
|
||||
<el-table-column prop="update_time" label="修改时间" min-width="150" />
|
||||
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
@@ -76,6 +86,11 @@
|
||||
<pagination />
|
||||
</div>
|
||||
<AddDialog />
|
||||
<UploadDialog
|
||||
:dialog-show.sync="uploadShow"
|
||||
@tableChanged3="tableChanged3"
|
||||
/>
|
||||
<Dialog :dialog-show.sync="dialogShow" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -87,12 +102,13 @@ import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import AddDialog from '@/views/wms/pdm/base/bom/AddDialog'
|
||||
import UploadDialog from '@/views/wms/pdm/base/bom/UploadDialog'
|
||||
|
||||
const defaultForm = { bom_uuid: null, bom_code: null, bom_name: null, material_uuid: null, processroute_uuid: null, yield_rate: null, endproduct_rate: null, bom_status: null, detail_count: null, remark: null, create_id: null, create_name: null, create_time: null, update_optid: null, update_optname: null, update_time: null }
|
||||
export default {
|
||||
name: 'Bom',
|
||||
dicts: ['BOM_STATUS'],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, AddDialog },
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, AddDialog, UploadDialog },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({ title: 'BOM单管理', url: 'api/bom', idField: 'bom_uuid', sort: 'bom_uuid,desc',
|
||||
@@ -107,6 +123,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
uploadShow: false,
|
||||
permission: {
|
||||
},
|
||||
rules: {
|
||||
@@ -149,6 +166,9 @@ export default {
|
||||
return true
|
||||
}
|
||||
},
|
||||
tableChanged3() {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
// 取消提交
|
||||
cancelSubmit(row) {
|
||||
crudBom.cancelSubmit({ bom_uuid: row.bom_uuid }).then(res => {
|
||||
|
||||
Reference in New Issue
Block a user