物料接口 工艺接口
This commit is contained in:
parent
eb7bab9964
commit
df6804190c
@ -66,7 +66,7 @@ public class ExcelUtil {
|
||||
}
|
||||
public static <T> ExcelResult<T> importExcelSheet6(InputStream is, Class<T> clazz, boolean isValidate) {
|
||||
DefaultExcelListener<T> listener = new DefaultExcelListener<>(isValidate);
|
||||
EasyExcel.read(is, clazz, listener).sheet(6).doRead();
|
||||
EasyExcel.read(is, clazz, listener).sheet(5).doRead();
|
||||
return listener.getExcelResult();
|
||||
}
|
||||
public static <T> ExcelResult<T> importExcelSheet1(InputStream is, Class<T> clazz, boolean isValidate) {
|
||||
|
||||
@ -0,0 +1,117 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.ruoyi.system.service.IProcessRouteService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.vo.ProductionRouteTwoVo;
|
||||
import com.ruoyi.system.domain.bo.ProductionRouteTwoBo;
|
||||
import com.ruoyi.system.service.IProductionRouteTwoService;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 工艺生产用表
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-26
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/system/routeTwo")
|
||||
public class ProductionRouteTwoController extends BaseController {
|
||||
|
||||
private final IProductionRouteTwoService iProductionRouteTwoService;
|
||||
@Autowired
|
||||
IProcessRouteService iProcessRouteService;
|
||||
/**
|
||||
* 查询工艺生产用表列表
|
||||
*/
|
||||
@SaCheckPermission("system:routeTwo:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<ProductionRouteTwoVo> list(ProductionRouteTwoBo bo, PageQuery pageQuery) {
|
||||
return iProductionRouteTwoService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出工艺生产用表列表
|
||||
*/
|
||||
@SaCheckPermission("system:routeTwo:export")
|
||||
@Log(title = "工艺生产用表", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(ProductionRouteTwoBo bo, HttpServletResponse response) {
|
||||
List<ProductionRouteTwoVo> list = iProductionRouteTwoService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "工艺生产用表", ProductionRouteTwoVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工艺生产用表详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("system:routeTwo:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<ProductionRouteTwoVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(iProductionRouteTwoService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工艺生产用表
|
||||
*/
|
||||
@SaCheckPermission("system:routeTwo:add")
|
||||
@Log(title = "工艺生产用表", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody ProductionRouteTwoBo bo) {
|
||||
return toAjax(iProductionRouteTwoService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工艺生产用表
|
||||
*/
|
||||
@SaCheckPermission("system:routeTwo:edit")
|
||||
@Log(title = "工艺生产用表", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ProductionRouteTwoBo bo) {
|
||||
return toAjax(iProductionRouteTwoService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工艺生产用表
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("system:routeTwo:remove")
|
||||
@Log(title = "工艺生产用表", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(iProductionRouteTwoService.deleteWithValidByIds(Arrays.asList(ids), true));
|
||||
}
|
||||
|
||||
@Log(title = "获取此项目数据")
|
||||
@SaCheckPermission("system:route:getRawBom")
|
||||
@PostMapping("/getSelecPlanRouteList")
|
||||
public boolean getSelecPlanRouteList(@RequestParam String rooteProdet) {
|
||||
return iProductionRouteTwoService.getSelecPlanRouteList(rooteProdet);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/system/jeecg")
|
||||
public class ReportController {
|
||||
@GetMapping(value = "/getReport")
|
||||
public String getReport(HttpServletRequest request) {
|
||||
String scheme = request.getScheme();
|
||||
String serverName = request.getServerName();
|
||||
int serverPort = request.getServerPort();
|
||||
String baseUrl = scheme + "://" + serverName + ":" + serverPort;
|
||||
return baseUrl+"/jmreport/list";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,119 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 工艺生产用表对象 production_route_two
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-26
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("production_route_two")
|
||||
public class ProductionRouteTwo extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private String fHbytSclh;
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
private String fProductName;
|
||||
/**
|
||||
* 产品编码
|
||||
*/
|
||||
private String fproductidFnumber;
|
||||
/**
|
||||
* 生产订单数量
|
||||
*/
|
||||
private Long fMOQty;
|
||||
/**
|
||||
* 工序编号
|
||||
*/
|
||||
private String fOperNumber;
|
||||
/**
|
||||
* 工作中心
|
||||
*/
|
||||
private String fworkcenteridFname;
|
||||
/**
|
||||
* 工艺名称
|
||||
*/
|
||||
private String fprocessidFname;
|
||||
/**
|
||||
* 工序描述
|
||||
*/
|
||||
private String fOperDescription;
|
||||
/**
|
||||
* 工序控制码
|
||||
*/
|
||||
private String fOptCtrlCodeidFname;
|
||||
/**
|
||||
* 工序数量
|
||||
*/
|
||||
private Long fOperQty;
|
||||
/**
|
||||
* 工序计划开始时间
|
||||
*/
|
||||
private Date fOperPlanStartTime;
|
||||
/**
|
||||
* 工序计划结束时间
|
||||
*/
|
||||
private Date fOperPlanFinishTime;
|
||||
/**
|
||||
* 计划开始时间
|
||||
*/
|
||||
private Date fPlanStartTime;
|
||||
/**
|
||||
* 计划结束时间
|
||||
*/
|
||||
private Date fPlanFinishTime;
|
||||
/**
|
||||
* 材质
|
||||
*/
|
||||
private String fmaterialidFnumber;
|
||||
/**
|
||||
* 子项单位
|
||||
*/
|
||||
private String funitid2ChildFname;
|
||||
/**
|
||||
* 父级物料编码
|
||||
*/
|
||||
private String fmaterialFnumber;
|
||||
/**
|
||||
* 子项物料名称
|
||||
*/
|
||||
private String fMaterialName1;
|
||||
/**
|
||||
* 子项物料编码
|
||||
*/
|
||||
private String fMaterialid2ChildFnumber;
|
||||
/**
|
||||
* 分子
|
||||
*/
|
||||
private Long fNumerator;
|
||||
/**
|
||||
* 分母
|
||||
*/
|
||||
private Long fDenominator;
|
||||
/**
|
||||
* 活动时长
|
||||
*/
|
||||
private Long activityLengh;
|
||||
/**
|
||||
* bom材质
|
||||
*/
|
||||
private String childMaterial;
|
||||
}
|
||||
@ -0,0 +1,167 @@
|
||||
package com.ruoyi.system.domain.bo;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 工艺生产用表业务对象 production_route_two
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-26
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ProductionRouteTwoBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@NotNull(message = "不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
/**
|
||||
* 生产令号
|
||||
*/
|
||||
@NotBlank(message = "生产令号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String fHbytSclh;
|
||||
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
@NotBlank(message = "产品名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String fProductName;
|
||||
|
||||
/**
|
||||
* 产品编码
|
||||
*/
|
||||
@NotBlank(message = "产品编码不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String fproductidFnumber;
|
||||
|
||||
/**
|
||||
* 生产订单数量
|
||||
*/
|
||||
@NotNull(message = "生产订单数量不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long fMOQty;
|
||||
|
||||
/**
|
||||
* 工序编号
|
||||
*/
|
||||
@NotBlank(message = "工序编号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String fOperNumber;
|
||||
|
||||
/**
|
||||
* 工作中心
|
||||
*/
|
||||
@NotBlank(message = "工作中心不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String fworkcenteridFname;
|
||||
|
||||
/**
|
||||
* 工艺名称
|
||||
*/
|
||||
@NotBlank(message = "工艺名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String fprocessidFname;
|
||||
|
||||
/**
|
||||
* 工序描述
|
||||
*/
|
||||
@NotBlank(message = "工序描述不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String fOperDescription;
|
||||
|
||||
/**
|
||||
* 工序控制码
|
||||
*/
|
||||
@NotBlank(message = "工序控制码不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String fOptCtrlCodeidFname;
|
||||
|
||||
/**
|
||||
* 工序数量
|
||||
*/
|
||||
@NotNull(message = "工序数量不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long fOperQty;
|
||||
|
||||
/**
|
||||
* 工序计划开始时间
|
||||
*/
|
||||
@NotNull(message = "工序计划开始时间不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Date fOperPlanStartTime;
|
||||
|
||||
/**
|
||||
* 工序计划结束时间
|
||||
*/
|
||||
@NotNull(message = "工序计划结束时间不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Date fOperPlanFinishTime;
|
||||
|
||||
/**
|
||||
* 计划开始时间
|
||||
*/
|
||||
@NotNull(message = "计划开始时间不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Date fPlanStartTime;
|
||||
|
||||
/**
|
||||
* 计划结束时间
|
||||
*/
|
||||
@NotNull(message = "计划结束时间不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Date fPlanFinishTime;
|
||||
|
||||
/**
|
||||
* 材质
|
||||
*/
|
||||
@NotBlank(message = "材质不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String fmaterialidFnumber;
|
||||
|
||||
/**
|
||||
* 子项单位
|
||||
*/
|
||||
@NotBlank(message = "子项单位不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String funitid2ChildFname;
|
||||
|
||||
/**
|
||||
* 父级物料编码
|
||||
*/
|
||||
@NotBlank(message = "父级物料编码不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String fmaterialFnumber;
|
||||
|
||||
/**
|
||||
* 子项物料名称
|
||||
*/
|
||||
@NotBlank(message = "子项物料名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String fMaterialName1;
|
||||
|
||||
/**
|
||||
* 子项物料编码
|
||||
*/
|
||||
@NotBlank(message = "子项物料编码不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String fMaterialid2ChildFnumber;
|
||||
|
||||
/**
|
||||
* 分子
|
||||
*/
|
||||
@NotNull(message = "分子不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long fNumerator;
|
||||
|
||||
/**
|
||||
* 分母
|
||||
*/
|
||||
@NotNull(message = "分母不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long fDenominator;
|
||||
/**
|
||||
* 活动时长
|
||||
*/
|
||||
@NotNull(message = "活动时长不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long activityLengh;
|
||||
|
||||
/**
|
||||
* bom材质
|
||||
*/
|
||||
@NotBlank(message = "bom材质不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String childMaterial;
|
||||
|
||||
|
||||
}
|
||||
@ -10,6 +10,7 @@ public class CombinedDTO {
|
||||
private String orderNumber; // 生产订单号
|
||||
private String materialCode; // 物料编码
|
||||
private String materialName; // 物料名称
|
||||
private String material; // 物料名称
|
||||
private List<PlannedProcessVo> processes; // 工序集合
|
||||
private List<MaterialUsageDTO> materialUsageDTOList; // 工序集合
|
||||
private List<MaterialUsageDTO> materialUsageDTOList; // 用量集合
|
||||
}
|
||||
|
||||
@ -13,8 +13,10 @@ public class MaterialUsageDTO {
|
||||
@JsonProperty("FMaterialName1")
|
||||
private String materialName; // 物料名称
|
||||
@JsonProperty("FMaterialModel1")
|
||||
private String specification; // 规格型号
|
||||
@JsonProperty("FUnitID2")
|
||||
private String specification; // 规格型号D
|
||||
@JsonProperty("F_HBYT_CZ")
|
||||
private String childMaterial; // 规格型号D
|
||||
@JsonProperty("FUnitID2.FName")
|
||||
private String unit; // 单位
|
||||
@JsonProperty("FMaterialType")
|
||||
private String itemType; // 子项类型
|
||||
@ -26,6 +28,10 @@ public class MaterialUsageDTO {
|
||||
private String stockName; // 仓库
|
||||
@JsonProperty("FMEMO1")
|
||||
private String remarks; // 备注
|
||||
@JsonProperty("FNumerator")
|
||||
private Long FNumerator; // 备注
|
||||
@JsonProperty("FDenominator")
|
||||
private Long FDenominator; // 备注
|
||||
//需求日期
|
||||
@JsonProperty("FNeedDate2")
|
||||
private Date needDate;
|
||||
|
||||
@ -25,7 +25,6 @@ public class PlanPrcessNumDTO {
|
||||
private Date FPlanStartTime;
|
||||
@JsonProperty("FPlanFinishTime")
|
||||
private Date FPlanFinishTime;
|
||||
|
||||
@JsonProperty("FSubEntity_FDetailID")
|
||||
private int FSubEntity_FDetailID;
|
||||
@JsonProperty("FOperPlanStartTime")
|
||||
|
||||
@ -54,5 +54,7 @@ public class PlanOrderVo {
|
||||
@JsonProperty("FMaterialName")
|
||||
private String FMaterialName;
|
||||
|
||||
@JsonProperty("F_UCHN_BaseProperty_qtr")
|
||||
private String BasePropertyqtr;
|
||||
|
||||
}
|
||||
|
||||
@ -49,6 +49,7 @@ public class PlannedProcessVo {
|
||||
@ExcelProperty(value = "工序名称")
|
||||
@JsonProperty("FProcessId.FName")
|
||||
private String FProcessName;
|
||||
|
||||
@JsonProperty("FActivity1BaseQty")
|
||||
private Double FActivity1BaseQty;
|
||||
/**
|
||||
@ -124,4 +125,15 @@ public class PlannedProcessVo {
|
||||
|
||||
@JsonProperty("FOptCtrlCodeId.FName")
|
||||
private String FOptCtrlCodeIFName;
|
||||
/**
|
||||
* 分子
|
||||
*/
|
||||
@JsonProperty("FNumerator")
|
||||
private Long fNumerator;
|
||||
|
||||
/**
|
||||
* 分母
|
||||
*/
|
||||
@JsonProperty("FDenominator")
|
||||
private Long fDenominator;
|
||||
}
|
||||
|
||||
@ -0,0 +1,168 @@
|
||||
package com.ruoyi.system.domain.vo;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.ruoyi.common.annotation.ExcelDictFormat;
|
||||
import com.ruoyi.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 工艺生产用表视图对象 production_route_two
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-26
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ProductionRouteTwoVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ExcelProperty(value = "")
|
||||
private Long id;
|
||||
//F_HBYT_SCLH,FProductId.FNumber,FProductName,FMOQty , FOperNumber,FWorkCenterId.FName ,FProcessId.FName,FOperDescription,FOptCtrlCodeId.FName,FOperQty ,FOperPlanStartTime ,FOperPlanFinishTime,FPlanStartTime,FPlanFinishTime
|
||||
/**
|
||||
* 生产令号
|
||||
*/
|
||||
@ExcelProperty(value = "生产令号")
|
||||
private String fHbytSclh;
|
||||
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
@ExcelProperty(value = "产品名称")
|
||||
private String fProductName;
|
||||
|
||||
/**
|
||||
* 产品编码
|
||||
*/
|
||||
@ExcelProperty(value = "产品编码")
|
||||
private String fproductidFnumber;
|
||||
|
||||
/**
|
||||
* 生产订单数量
|
||||
*/
|
||||
@ExcelProperty(value = "生产订单数量")
|
||||
private Long fMOQty;
|
||||
|
||||
/**
|
||||
* 工序编号
|
||||
*/
|
||||
@ExcelProperty(value = "工序编号")
|
||||
private String fOperNumber;
|
||||
|
||||
/**
|
||||
* 工作中心
|
||||
*/
|
||||
@ExcelProperty(value = "工作中心")
|
||||
private String fworkcenteridFname;
|
||||
|
||||
/**
|
||||
* 工艺名称
|
||||
*/
|
||||
@ExcelProperty(value = "工艺名称")
|
||||
private String fprocessidFname;
|
||||
|
||||
/**
|
||||
* 工序描述
|
||||
*/
|
||||
@ExcelProperty(value = "工序描述")
|
||||
private String fOperDescription;
|
||||
|
||||
/**
|
||||
* 工序控制码
|
||||
*/
|
||||
@ExcelProperty(value = "工序控制码")
|
||||
private String fOptCtrlCodeidFname;
|
||||
|
||||
/**
|
||||
* 工序数量
|
||||
*/
|
||||
@ExcelProperty(value = "工序数量")
|
||||
private Long fOperQty;
|
||||
|
||||
/**
|
||||
* 工序计划开始时间
|
||||
*/
|
||||
@ExcelProperty(value = "工序计划开始时间")
|
||||
private Date fOperPlanStartTime;
|
||||
|
||||
/**
|
||||
* 工序计划结束时间
|
||||
*/
|
||||
@ExcelProperty(value = "工序计划结束时间")
|
||||
private Date fOperPlanFinishTime;
|
||||
|
||||
/**
|
||||
* 计划开始时间
|
||||
*/
|
||||
@ExcelProperty(value = "计划开始时间")
|
||||
private Date fPlanStartTime;
|
||||
|
||||
/**
|
||||
* 计划结束时间
|
||||
*/
|
||||
@ExcelProperty(value = "计划结束时间")
|
||||
private Date fPlanFinishTime;
|
||||
|
||||
/**
|
||||
* 材质
|
||||
*/
|
||||
@ExcelProperty(value = "材质")
|
||||
private String fmaterialidFnumber;
|
||||
|
||||
/**
|
||||
* 子项单位
|
||||
*/
|
||||
@ExcelProperty(value = "子项单位")
|
||||
private String funitid2ChildFname;
|
||||
|
||||
/**
|
||||
* 父级物料编码
|
||||
*/
|
||||
@ExcelProperty(value = "父级物料编码")
|
||||
private String fmaterialFnumber;
|
||||
|
||||
/**
|
||||
* 子项物料名称
|
||||
*/
|
||||
@ExcelProperty(value = "子项物料名称")
|
||||
private String fMaterialName1;
|
||||
|
||||
/**
|
||||
* 子项物料编码
|
||||
*/
|
||||
@ExcelProperty(value = "子项物料编码")
|
||||
private String fMaterialid2ChildFnumber;
|
||||
|
||||
/**
|
||||
* 分子
|
||||
*/
|
||||
@ExcelProperty(value = "分子")
|
||||
private Long fNumerator;
|
||||
|
||||
/**
|
||||
* 分母
|
||||
*/
|
||||
@ExcelProperty(value = "分母")
|
||||
private Long fDenominator;
|
||||
/**
|
||||
* 活动时长
|
||||
*/
|
||||
@ExcelProperty(value = "活动时长")
|
||||
private Long activityLengh;
|
||||
|
||||
/**
|
||||
* bom材质
|
||||
*/
|
||||
@ExcelProperty(value = "bom材质")
|
||||
private String childMaterial;
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import com.ruoyi.system.domain.ProductionRouteTwo;
|
||||
import com.ruoyi.system.domain.vo.ProductionRouteTwoVo;
|
||||
import com.ruoyi.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 工艺生产用表Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-26
|
||||
*/
|
||||
public interface ProductionRouteTwoMapper extends BaseMapperPlus<ProductionRouteTwoMapper, ProductionRouteTwo, ProductionRouteTwoVo> {
|
||||
|
||||
}
|
||||
@ -10,6 +10,7 @@ import com.kingdee.bos.webapi.sdk.K3CloudApi;
|
||||
import com.ruoyi.system.domain.dto.PlanPrcessNumDTO;
|
||||
import com.ruoyi.system.domain.vo.ImMaterialVo;
|
||||
import com.ruoyi.system.domain.vo.PlanOrderVo;
|
||||
import com.ruoyi.system.domain.vo.ProductionRouteTwoVo;
|
||||
import com.ruoyi.system.jdmain.rouplan.Model;
|
||||
import com.ruoyi.system.mapper.ImProductionPlanProMapper;
|
||||
import com.ruoyi.system.service.IImProductionPlanProService;
|
||||
@ -278,10 +279,10 @@ public class JdUtil {
|
||||
|
||||
|
||||
public static List<Model> getSelecPlan(String rooteProdet) {
|
||||
List<PlanOrderVo> planOrderList = getSelectProceOrder(rooteProdet);
|
||||
List<ProductionRouteTwoVo> planOrderList = getSelectProceOrder(rooteProdet);
|
||||
List<PlanPrcessNumDTO> plannedProcesses = new ArrayList<>();
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
for (PlanOrderVo planOrder : planOrderList) {
|
||||
for (ProductionRouteTwoVo planOrder : planOrderList) {
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("FormId", "SFC_OperationPlanning");
|
||||
json.addProperty("FieldKeys", "FID,FSubEntity_FDetailID,FProductId.FNumber,FOperNumber,FEntity_FEntryID,FProcessId.FName,FSeqNumber,FSeqName,FPlanStartTime,FPlanFinishTime," +
|
||||
@ -291,7 +292,7 @@ public class JdUtil {
|
||||
JsonObject filterObject = new JsonObject();
|
||||
filterObject.addProperty("FieldName", "FMONumber");
|
||||
filterObject.addProperty("Compare", "="); // 改为等号运算符
|
||||
filterObject.addProperty("Value", planOrder.getFBillNo());
|
||||
// filterObject.addProperty("Value", planOrder.getFBillNo());
|
||||
filterObject.addProperty("Left", "");
|
||||
filterObject.addProperty("Right", "");
|
||||
filterObject.addProperty("Logic", 0);// 从 PlanOrderVo 获取生产令号
|
||||
@ -308,7 +309,7 @@ public class JdUtil {
|
||||
try {
|
||||
String resultJson = String.valueOf(client.billQuery(jsonData));
|
||||
System.out.println(
|
||||
"生成查询计划订单查询 " + planOrder.getFBillNo() + " 的结果: " + resultJson
|
||||
// "生成查询计划订单查询 " + planOrder.getFBillNo() + " 的结果: " + resultJson
|
||||
);
|
||||
JsonArray jsonArray = new Gson().fromJson(resultJson, JsonArray.class);
|
||||
if (jsonArray == null || jsonArray.size() == 0) {
|
||||
@ -329,7 +330,7 @@ public class JdUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<PlanOrderVo> getSelectProceOrder(String rooteProdet) {
|
||||
public static List<ProductionRouteTwoVo> getSelectProceOrder(String rooteProdet) {
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
//请求参数,要求为json字符串
|
||||
JsonObject json = new JsonObject();
|
||||
@ -360,11 +361,10 @@ public class JdUtil {
|
||||
JsonArray jsonArray = new Gson().fromJson(resultJson, JsonArray.class);
|
||||
// 将JsonArray转为PlanOrder列表
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<PlanOrderVo> planOrders = objectMapper.readValue(jsonArray.toString(), new TypeReference<List<PlanOrderVo>>() {
|
||||
List<ProductionRouteTwoVo> productionRouteTwoVos = objectMapper.readValue(jsonArray.toString(), new TypeReference<List<ProductionRouteTwoVo>>() {
|
||||
});
|
||||
// 输出或返回结果
|
||||
System.out.println(planOrders);
|
||||
return planOrders;
|
||||
return productionRouteTwoVos;
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -383,11 +383,11 @@ public class JdUtil {
|
||||
"FChildBaseUnitID.FNumber": "jian"
|
||||
},
|
||||
*/
|
||||
public static List<Model> get物料清单(String materialCode) {
|
||||
List<PlanOrderVo> planOrderList = getSelectProceOrder(materialCode);
|
||||
public static List<Model> getPlanOrderVo(String materialCode) {
|
||||
List<ProductionRouteTwoVo> planOrderList = getSelectProceOrder(materialCode);
|
||||
List<PlanPrcessNumDTO> plannedProcesses = new ArrayList<>();
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
for (PlanOrderVo planOrder : planOrderList) {
|
||||
for (ProductionRouteTwoVo planOrder : planOrderList) {
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("FormId", "ENG_BOM");
|
||||
json.addProperty("FieldKeys", "F_HBYT_SCLH,FMaterialID.FNumber,FMaterialID.FNumber2,FMaterialName1,FNumerator,FDenominator,FUnitID2.FName");
|
||||
@ -395,7 +395,7 @@ public class JdUtil {
|
||||
JsonObject filterObject = new JsonObject();
|
||||
filterObject.addProperty("FieldName", "FMaterialID.FNumber");
|
||||
filterObject.addProperty("Compare", "="); // 改为等号运算符
|
||||
filterObject.addProperty("Value", planOrder.getFBillNo());
|
||||
// filterObject.addProperty("Value", planOrder.getFBillNo());
|
||||
filterObject.addProperty("Left", "");
|
||||
filterObject.addProperty("Right", "");
|
||||
filterObject.addProperty("Logic", 0);// 从 PlanOrderVo 获取生产令号
|
||||
@ -412,7 +412,7 @@ public class JdUtil {
|
||||
try {
|
||||
String resultJson = String.valueOf(client.billQuery(jsonData));
|
||||
System.out.println(
|
||||
"生成查询计划订单查询 " + planOrder.getFBillNo() + " 的结果: " + resultJson
|
||||
// "生成查询计划订单查询 " + planOrder.getFBillNo() + " 的结果: " + resultJson
|
||||
);
|
||||
JsonArray jsonArray = new Gson().fromJson(resultJson, JsonArray.class);
|
||||
if (jsonArray == null || jsonArray.size() == 0) {
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.system.domain.vo.ProductionRouteTwoVo;
|
||||
import com.ruoyi.system.domain.bo.ProductionRouteTwoBo;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工艺生产用表Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-26
|
||||
*/
|
||||
public interface IProductionRouteTwoService {
|
||||
|
||||
/**
|
||||
* 查询工艺生产用表
|
||||
*/
|
||||
ProductionRouteTwoVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询工艺生产用表列表
|
||||
*/
|
||||
TableDataInfo<ProductionRouteTwoVo> queryPageList(ProductionRouteTwoBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询工艺生产用表列表
|
||||
*/
|
||||
List<ProductionRouteTwoVo> queryList(ProductionRouteTwoBo bo);
|
||||
|
||||
/**
|
||||
* 新增工艺生产用表
|
||||
*/
|
||||
Boolean insertByBo(ProductionRouteTwoBo bo);
|
||||
|
||||
/**
|
||||
* 修改工艺生产用表
|
||||
*/
|
||||
Boolean updateByBo(ProductionRouteTwoBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除工艺生产用表信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
boolean getSelecPlanRouteList(String rooteProdet);
|
||||
}
|
||||
@ -442,15 +442,19 @@ public class ProcessRouteServiceImpl implements IProcessRouteService {
|
||||
|
||||
private List<BomDetailsVo> processBomDetails(List<ProcessRoute> processRoutes, List<ProductionOrderVo> productionOrderVos) {
|
||||
List<BomDetailsVo> bomDetailsVos = new ArrayList<>();
|
||||
// 是否已处理过总装部件
|
||||
boolean hasProcessedAssemblyPart = false;
|
||||
// 1. 处理总装部件
|
||||
for (ProcessRoute processRoute : processRoutes) {
|
||||
if (processRoute != null) {
|
||||
String zFlinghao = processRoute.getRouteDescription();
|
||||
if ("总装部件".equals(processRoute.getMaterial())) {
|
||||
if ("总装部件".equals(processRoute.getMaterial())&& !hasProcessedAssemblyPart) {
|
||||
String zFnumber = processRoute.getMaterialCode();
|
||||
String zFname = processRoute.getMaterialName();
|
||||
// 将装配 BOM 详情填充进 BOM 详情列表
|
||||
createAssemblyBomDetails(zFlinghao, zFnumber, zFname, productionOrderVos);
|
||||
// 设置标志为已处理
|
||||
hasProcessedAssemblyPart = true;
|
||||
continue;
|
||||
}
|
||||
if (processRoute.getRawMaterialCode() != null || processRoute.getRawMaterialName() != null || processRoute.getBomMaterial() != null || processRoute.getBomUnit() != null) {
|
||||
@ -459,7 +463,6 @@ public class ProcessRouteServiceImpl implements IProcessRouteService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bomDetailsVos;
|
||||
}
|
||||
|
||||
@ -499,6 +502,7 @@ public class ProcessRouteServiceImpl implements IProcessRouteService {
|
||||
private void createAssemblyBomDetails(String zFlinghao, String zFnumber, String zFname, List<ProductionOrderVo> productionOrderVos) {
|
||||
ArrayList<BomDetailsVo> bomDetailsVos = new ArrayList<>();
|
||||
for (ProductionOrderVo productionOrderVo : productionOrderVos) {
|
||||
if (productionOrderVo !=null){
|
||||
BomDetailsVo bomDetails = new BomDetailsVo();
|
||||
bomDetails.setTotalWeight(zFlinghao);
|
||||
bomDetails.setFNumber(zFnumber);
|
||||
@ -509,16 +513,22 @@ public class ProcessRouteServiceImpl implements IProcessRouteService {
|
||||
bomDetails.setName(productionOrderVo.getDrawingName());
|
||||
bomDetails.setQuantity(Double.valueOf(productionOrderVo.getQuantity()));
|
||||
bomDetails.setMaterial(productionOrderVo.getMaterial());
|
||||
|
||||
// 判断外购或自制
|
||||
if (isOutsourced(productionOrderVo.getDrawingNo())) {
|
||||
String drawingNo = productionOrderVo.getDrawingNo();
|
||||
String remark = productionOrderVo.getRemark();
|
||||
if (drawingNo != null ){
|
||||
if ((isOutsourced(drawingNo) || (remark != null && remark.contains("外购件")) || drawingNo.startsWith(" "))||drawingNo.startsWith("009")) {
|
||||
bomDetails.setStats("外购");
|
||||
} else {
|
||||
bomDetails.setStats("自制");
|
||||
}
|
||||
}
|
||||
|
||||
// iBomDetailsService.insertByVo(bomDetails);
|
||||
bomDetailsVos.add(bomDetails);
|
||||
}
|
||||
|
||||
}
|
||||
log.info("总装bom物料添加");
|
||||
|
||||
saveBomDetails(bomDetailsVos);
|
||||
@ -756,6 +766,7 @@ public class ProcessRouteServiceImpl implements IProcessRouteService {
|
||||
iBomDetailsService.updateByBo(BeanUtil.toBean(material, BomDetailsBo.class));
|
||||
}
|
||||
}
|
||||
|
||||
private void saveBomDetails1(List<BomDetailsVo> bomDetailsVos) {
|
||||
List<BomDetails> materialsToAdd = new ArrayList<>();
|
||||
for (BomDetailsVo bomDetailsVo : bomDetailsVos) {
|
||||
@ -966,8 +977,11 @@ public class ProcessRouteServiceImpl implements IProcessRouteService {
|
||||
// 使用 ObjectMapper 将 JsonArray 转换为 List<PlannedProcessVo>
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<PlannedProcessVo> plannedProcessList = objectMapper.readValue(jsonArray.toString(), new TypeReference<List<PlannedProcessVo>>() {
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
// 检查 plannedProcessList 是否为 null,避免空指针异常
|
||||
if (plannedProcessList != null && !plannedProcessList.isEmpty()) {
|
||||
plannedProcesses.addAll(plannedProcessList); // 将非空列表添加到最终列表中
|
||||
@ -980,6 +994,7 @@ public class ProcessRouteServiceImpl implements IProcessRouteService {
|
||||
combined.setMaterialCode(planOrder.getFmaterialidFnumber()); // 物料编码
|
||||
combined.setMaterialName(planOrder.getFMaterialName()); // 物料名称
|
||||
combined.setProcesses(plannedProcessList);
|
||||
combined.setMaterial(planOrder.getBasePropertyqtr());
|
||||
combined.setMaterialUsageDTOList(materialUseList);
|
||||
// 5. 添加到最终合并的列表中
|
||||
combinedVoList.add(combined);
|
||||
@ -1005,7 +1020,7 @@ public class ProcessRouteServiceImpl implements IProcessRouteService {
|
||||
//请求参数,要求为json字符串
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("FormId", "PRD_MO");
|
||||
json.addProperty("FieldKeys", "F_HBYT_SCLH,FBillNo ,FMaterialId.FNumber,FMaterialName");
|
||||
json.addProperty("FieldKeys", "F_HBYT_SCLH,FBillNo ,FMaterialId.FNumber,FMaterialName, F_UCHN_BaseProperty_qtr");
|
||||
JsonArray filterString = new JsonArray();
|
||||
JsonObject filterObject = new JsonObject();
|
||||
filterObject.addProperty("FieldName", "F_HBYT_SCLH");
|
||||
@ -1050,7 +1065,7 @@ public class ProcessRouteServiceImpl implements IProcessRouteService {
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("FormId", "PRD_PPBOM");
|
||||
|
||||
json.addProperty("FieldKeys", "FBillNo,FMaterialID2.FNumber,FMaterialName1,FMaterialModel1,FMaterialType,FMustQty,FPickedQty,FStockID.FName,FMEMO1");
|
||||
json.addProperty("FieldKeys", "FBillNo,FMaterialID2.FNumber,FMaterialName1,FMaterialModel1,F_HBYT_CZ,FMaterialType,FMustQty,FPickedQty,FStockID.FName,FMEMO1,FUnitID2.FName,FNumerator,FDenominator");
|
||||
JsonArray filterString = new JsonArray();
|
||||
JsonObject filterObject = new JsonObject();
|
||||
filterObject.addProperty("FieldName", "FMOBillNO");
|
||||
|
||||
@ -0,0 +1,203 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.system.domain.dto.CombinedDTO;
|
||||
import com.ruoyi.system.domain.dto.MaterialUsageDTO;
|
||||
import com.ruoyi.system.domain.vo.PlannedProcessVo;
|
||||
import com.ruoyi.system.service.IProcessRouteService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.domain.bo.ProductionRouteTwoBo;
|
||||
import com.ruoyi.system.domain.vo.ProductionRouteTwoVo;
|
||||
import com.ruoyi.system.domain.ProductionRouteTwo;
|
||||
import com.ruoyi.system.mapper.ProductionRouteTwoMapper;
|
||||
import com.ruoyi.system.service.IProductionRouteTwoService;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 工艺生产用表Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-26
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class ProductionRouteTwoServiceImpl implements IProductionRouteTwoService {
|
||||
|
||||
private final ProductionRouteTwoMapper baseMapper;
|
||||
|
||||
@Autowired
|
||||
IProcessRouteService iProcessRouteService;
|
||||
|
||||
/**
|
||||
* 查询工艺生产用表
|
||||
*/
|
||||
@Override
|
||||
public ProductionRouteTwoVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询工艺生产用表列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<ProductionRouteTwoVo> queryPageList(ProductionRouteTwoBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<ProductionRouteTwo> lqw = buildQueryWrapper(bo);
|
||||
Page<ProductionRouteTwoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询工艺生产用表列表
|
||||
*/
|
||||
@Override
|
||||
public List<ProductionRouteTwoVo> queryList(ProductionRouteTwoBo bo) {
|
||||
LambdaQueryWrapper<ProductionRouteTwo> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<ProductionRouteTwo> buildQueryWrapper(ProductionRouteTwoBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<ProductionRouteTwo> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getFHbytSclh()), ProductionRouteTwo::getFHbytSclh, bo.getFHbytSclh());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getFProductName()), ProductionRouteTwo::getFProductName, bo.getFProductName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getFproductidFnumber()), ProductionRouteTwo::getFproductidFnumber, bo.getFproductidFnumber());
|
||||
lqw.eq(bo.getFMOQty() != null, ProductionRouteTwo::getFMOQty, bo.getFMOQty());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getFOperNumber()), ProductionRouteTwo::getFOperNumber, bo.getFOperNumber());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getFworkcenteridFname()), ProductionRouteTwo::getFworkcenteridFname, bo.getFworkcenteridFname());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getFprocessidFname()), ProductionRouteTwo::getFprocessidFname, bo.getFprocessidFname());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getFOperDescription()), ProductionRouteTwo::getFOperDescription, bo.getFOperDescription());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getFOptCtrlCodeidFname()), ProductionRouteTwo::getFOptCtrlCodeidFname, bo.getFOptCtrlCodeidFname());
|
||||
lqw.eq(bo.getFOperQty() != null, ProductionRouteTwo::getFOperQty, bo.getFOperQty());
|
||||
lqw.eq(bo.getFOperPlanStartTime() != null, ProductionRouteTwo::getFOperPlanStartTime, bo.getFOperPlanStartTime());
|
||||
lqw.eq(bo.getFOperPlanFinishTime() != null, ProductionRouteTwo::getFOperPlanFinishTime, bo.getFOperPlanFinishTime());
|
||||
lqw.eq(bo.getFPlanStartTime() != null, ProductionRouteTwo::getFPlanStartTime, bo.getFPlanStartTime());
|
||||
lqw.eq(bo.getFPlanFinishTime() != null, ProductionRouteTwo::getFPlanFinishTime, bo.getFPlanFinishTime());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getFmaterialidFnumber()), ProductionRouteTwo::getFmaterialidFnumber, bo.getFmaterialidFnumber());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getFunitid2ChildFname()), ProductionRouteTwo::getFunitid2ChildFname, bo.getFunitid2ChildFname());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getFmaterialFnumber()), ProductionRouteTwo::getFmaterialFnumber, bo.getFmaterialFnumber());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getFMaterialName1()), ProductionRouteTwo::getFMaterialName1, bo.getFMaterialName1());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getFMaterialid2ChildFnumber()), ProductionRouteTwo::getFMaterialid2ChildFnumber, bo.getFMaterialid2ChildFnumber());
|
||||
lqw.eq(bo.getFNumerator() != null, ProductionRouteTwo::getFNumerator, bo.getFNumerator());
|
||||
lqw.eq(bo.getFDenominator() != null, ProductionRouteTwo::getFDenominator, bo.getFDenominator());
|
||||
lqw.eq(bo.getActivityLengh() != null, ProductionRouteTwo::getActivityLengh, bo.getActivityLengh());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getChildMaterial()), ProductionRouteTwo::getChildMaterial, bo.getChildMaterial());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工艺生产用表
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(ProductionRouteTwoBo bo) {
|
||||
ProductionRouteTwo add = BeanUtil.toBean(bo, ProductionRouteTwo.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工艺生产用表
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(ProductionRouteTwoBo bo) {
|
||||
ProductionRouteTwo update = BeanUtil.toBean(bo, ProductionRouteTwo.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(ProductionRouteTwo entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除工艺生产用表
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rooteProdet
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean getSelecPlanRouteList(String rooteProdet) {
|
||||
// 获取 CombinedDTO 数据
|
||||
List<CombinedDTO> selecPlanRouteList = iProcessRouteService.getSelecPlanRouteList(rooteProdet);
|
||||
List<ProductionRouteTwo> productionRouteTwoList = new ArrayList<>();
|
||||
|
||||
// 用于存储已处理过的工序号和物料的组合
|
||||
Set<String> processedCombinations = new HashSet<>();
|
||||
|
||||
// 遍历 CombinedDTO 列表
|
||||
for (CombinedDTO combinedDTO : selecPlanRouteList) {
|
||||
// 为每个 CombinedDTO 遍历每个工序
|
||||
for (PlannedProcessVo plannedProcess : combinedDTO.getProcesses()) {
|
||||
// 为每个工序,再遍历每个物料
|
||||
for (MaterialUsageDTO materialUsageDTO : combinedDTO.getMaterialUsageDTOList()) {
|
||||
// 生成一个唯一的工序和物料组合标识符
|
||||
String combinationKey = plannedProcess.getFOperNumber() + "-" + combinedDTO.getMaterialCode();
|
||||
|
||||
// 如果该组合已处理过,则跳过
|
||||
if (processedCombinations.contains(combinationKey)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 如果没有处理过,添加到 Set 中,表示该组合已处理
|
||||
processedCombinations.add(combinationKey);
|
||||
|
||||
// 创建一个新的 ProductionRouteTwo 对象
|
||||
ProductionRouteTwo productionRouteTwo = new ProductionRouteTwo();
|
||||
productionRouteTwo.setFHbytSclh(rooteProdet); // 设置生产路线编号
|
||||
productionRouteTwo.setFproductidFnumber(combinedDTO.getMaterialCode()); // 设置物料编码
|
||||
productionRouteTwo.setFProductName(combinedDTO.getMaterialName()); // 设置物料名称
|
||||
productionRouteTwo.setFmaterialidFnumber(combinedDTO.getMaterial());
|
||||
// 填充工序相关数据
|
||||
productionRouteTwo.setFOperNumber(String.valueOf(plannedProcess.getFOperNumber())); // 工序号
|
||||
productionRouteTwo.setFOperDescription(plannedProcess.getFOperDescription()); // 工序描述
|
||||
productionRouteTwo.setFOperQty(plannedProcess.getFActivity1BaseQty().longValue()); // 工序数量
|
||||
productionRouteTwo.setFOperPlanStartTime(plannedProcess.getFSeqPlanStartTime()); // 工序计划开始时间
|
||||
productionRouteTwo.setFOperPlanFinishTime(plannedProcess.getFSeqPlanFinishTime()); // 工序计划结束时间
|
||||
productionRouteTwo.setFPlanStartTime(plannedProcess.getFPlanStartTime()); // 计划开始时间
|
||||
productionRouteTwo.setFPlanFinishTime(plannedProcess.getFPlanFinishTime()); // 计划结束时间
|
||||
productionRouteTwo.setFworkcenteridFname(plannedProcess.getFWorkCenterName()); // 工作中心
|
||||
productionRouteTwo.setFprocessidFname(plannedProcess.getFProcessName()); // 工艺名称
|
||||
productionRouteTwo.setFOptCtrlCodeidFname(plannedProcess.getFOptCtrlCodeIFName());
|
||||
productionRouteTwo.setActivityLengh(Long.valueOf(String.valueOf(plannedProcess.getFActivity1BaseQty())));
|
||||
// 填充物料相关数据
|
||||
productionRouteTwo.setFMaterialid2ChildFnumber(materialUsageDTO.getMaterialCode()); // 物料编码
|
||||
productionRouteTwo.setFMaterialName1(materialUsageDTO.getMaterialName()); // 物料名称
|
||||
productionRouteTwo.setFNumerator(materialUsageDTO.getFNumerator()); // 分子fMaterialName1
|
||||
productionRouteTwo.setFDenominator(materialUsageDTO.getFDenominator()); // 分母
|
||||
productionRouteTwo.setFunitid2ChildFname(materialUsageDTO.getUnit());
|
||||
productionRouteTwo.setChildMaterial(materialUsageDTO.getChildMaterial());
|
||||
|
||||
// 将填充好的 ProductionRouteTwo 对象添加到列表中
|
||||
productionRouteTwoList.add(productionRouteTwo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 批量插入数据到数据库
|
||||
return baseMapper.insertBatch(productionRouteTwoList);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.ProductionRouteTwoMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.system.domain.ProductionRouteTwo" id="ProductionRouteTwoResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="fHbytSclh" column="F_HBYT_SCLH"/>
|
||||
<result property="fProductName" column="f_product_name"/>
|
||||
<result property="fproductidFnumber" column="FProductId_FNumber"/>
|
||||
<result property="fMOQty" column="f_m_o_qty"/>
|
||||
<result property="fOperNumber" column="f_oper_number"/>
|
||||
<result property="fworkcenteridFname" column="FWorkCenterId_FName"/>
|
||||
<result property="fprocessidFname" column="FProcessId_FName"/>
|
||||
<result property="fOperDescription" column="f_oper_description"/>
|
||||
<result property="fOptCtrlCodeidFname" column="F_Opt_Ctrl_CodeId_FName"/>
|
||||
<result property="fOperQty" column="f_oper_qty"/>
|
||||
<result property="fOperPlanStartTime" column="f_oper_plan_start_time"/>
|
||||
<result property="fOperPlanFinishTime" column="f_oper_plan_finish_time"/>
|
||||
<result property="fPlanStartTime" column="f_plan_start_time"/>
|
||||
<result property="fPlanFinishTime" column="f_plan_finish_time"/>
|
||||
<result property="fmaterialidFnumber" column="FMATERIALID_FNumber"/>
|
||||
<result property="funitid2ChildFname" column="FUnitID2_Child_FName"/>
|
||||
<result property="fmaterialFnumber" column="FMaterial_FNumber"/>
|
||||
<result property="fMaterialName1" column="f_material_name1"/>
|
||||
<result property="fMaterialid2ChildFnumber" column="F_MaterialID2_Child_FNumber"/>
|
||||
<result property="fNumerator" column="F_Numerator"/>
|
||||
<result property="fDenominator" column="F_Denominator"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="activityLengh" column="activity_lengh"/>
|
||||
<result property="childMaterial" column="child_material"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user