成本首页修改

This commit is contained in:
z 2025-07-15 21:08:25 +08:00
parent 9a27419fb3
commit 1ac8d6e277
39 changed files with 1121 additions and 212 deletions

View File

@ -147,6 +147,7 @@ public interface ErrorCodeConstants {
ErrorCode ZJ_BG_MASTER_LINE_NOT_EXISTS = new ErrorCode(1_011_001, "终检报工不存在");
ErrorCode MASTER_NOT_EXISTS = new ErrorCode(1_011_001, "借用主不存在");
ErrorCode MASTER_LINE_NOT_EXISTS = new ErrorCode(1_011_002, "借用物料行不存在");
ErrorCode ORDER_YF_NOT_EXISTS = new ErrorCode(1_011_001, "应付记录不存在");
ErrorCode ORDER_YS_NOT_EXISTS = new ErrorCode(1_011_001, "应收记录不存在");

View File

@ -151,7 +151,7 @@ public class bdgzsomthingController {
BeanUtils.toBean(list, bdgzsomthingRespVO.class));
}
// @Scheduled(fixedRate = 10800000)
@Scheduled(fixedRate = 10800000)
public void scheduledTask() {
bdgzsomthingService.selectds();
}
@ -159,8 +159,8 @@ public class bdgzsomthingController {
//@Scheduled(cron = "0 2 0 * * ?") //每天十天执行一次
@PostConstruct
public void init() {
// selectHasPrice();
// selectSafeStorageAndDeliverOneYear();
selectHasPrice();
selectSafeStorageAndDeliverOneYear();
// bdgzsomthingService.selectds();
}
@Scheduled(cron = "0 0 2 * * ?")

View File

@ -1,6 +1,7 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.master;
import cn.hutool.core.util.ObjectUtil;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.masterline.MasterLineDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO;
import com.chanko.yunxi.mes.module.heli.service.material.MaterialService;
import org.springframework.web.bind.annotation.*;
@ -14,6 +15,7 @@ import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.math.BigDecimal;
import java.util.*;
import java.io.IOException;
@ -71,21 +73,21 @@ public class MasterController {
@Operation(summary = "获得借用主")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('heli:master:query')")
public CommonResult<MasterRespVO> getMaster(@RequestParam("id") Integer id) {
public CommonResult<MasterDO> getMaster(@RequestParam("id") Integer id) {
MasterDO master = masterService.getMaster(id);
MaterialDO material = materialService.getMaterial(Long.valueOf(master.getJyMaster()));
if (ObjectUtil.isNotEmpty( material)){
master.setJyMasterName(material.getName());
}
return success(BeanUtils.toBean(master, MasterRespVO.class));
// MaterialDO material = materialService.getMaterial(Long.valueOf(master.getJyMaster()));
// if (ObjectUtil.isNotEmpty( material)){
// master.setJyMasterName(material.getName());
// }
return success(master);
}
@GetMapping("/page")
@Operation(summary = "获得借用主分页")
@PreAuthorize("@ss.hasPermission('heli:master:query')")
public CommonResult<PageResult<MasterRespVO>> getMasterPage(@Valid MasterPageReqVO pageReqVO) {
public CommonResult<PageResult<MasterDO>> getMasterPage(@Valid MasterPageReqVO pageReqVO) {
PageResult<MasterDO> pageResult = masterService.getMasterPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MasterRespVO.class));
return success(pageResult);
}
@GetMapping("/export-excel")
@ -100,5 +102,31 @@ public class MasterController {
ExcelUtils.write(response, "借用主.xls", "数据", MasterRespVO.class,
BeanUtils.toBean(list, MasterRespVO.class));
}
@GetMapping("/getMasterLinePage")
@Operation(summary = "获得借用主分页")
@PreAuthorize("@ss.hasPermission('heli:master:query')")
public CommonResult<PageResult<MasterLineDO>> getMasterLinePage(@Valid MasterPageReqVO pageReqVO) {
PageResult<MasterLineDO> pageResult = masterService.getMasterLinePage(pageReqVO);
return success(pageResult);
}
@GetMapping("/exportMasterLine")
@Operation(summary = "导出员工物料报表")
@OperateLog(type = EXPORT)
public void exportMasterLine(@Valid MasterPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<MasterLineDO> list = masterService.getMasterLinePage(pageReqVO).getList();
list.forEach(item -> {
if ("1".equals(item.getJyTypes())) {
item.setQuantityLent(new BigDecimal(item.getJyNum()));
} else {
if (ObjectUtil.isNotEmpty(item.getJyNum())){
item.setQuantityLent(new BigDecimal(item.getJyNum()).negate());
}
}
}); // 导出 Excel
ExcelUtils.write(response, "员工借用物料报表.xlsx", "数据", MasterRespVO.class,
BeanUtils.toBean(list, MasterRespVO.class));
}
}

View File

@ -1,6 +1,9 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.master.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.chanko.yunxi.mes.framework.excel.core.annotations.DictFormat;
import com.chanko.yunxi.mes.framework.excel.core.convert.DictConvert;
import com.chanko.yunxi.mes.framework.excel.core.convert.TimestampToDateConvert;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
@ -14,55 +17,60 @@ import com.alibaba.excel.annotation.*;
@Data
@ExcelIgnoreUnannotated
public class MasterRespVO {
@Schema(description = "责任人")
@ExcelProperty("责任人")
private String jyUsers;
@Schema(description = "部门")
@ExcelProperty("部门")
private String jyBms;
@Schema(description = "借用日期")
@ExcelProperty(value = "日期", converter = TimestampToDateConvert.class)
private LocalDateTime jyDate;
@Schema(description = "类型", example = "1")
@ExcelProperty(value = "类型", converter = DictConvert.class)
@DictFormat("heli_borrow_type")
private String jyTypes;
@Schema(description = "用途")
@ExcelProperty(value = "用途", converter = DictConvert.class)
@DictFormat("heli_use")
private String jyYt;
@Schema(description = "物料名称")
@ExcelProperty("物料名称")
private String jyMasters;
@Schema(description = "数量")
@ExcelProperty("数量")
private BigDecimal jyNum;
@Schema(description = "数量")
// @ExcelProperty("数量")
private BigDecimal num;
@Schema(description = "借出数量")
@ExcelProperty("借出数量")
private BigDecimal quantityLent;
@Schema(description = "备注")
@ExcelProperty("备注")
private String rems;
@Schema(description = "备注")
// @ExcelProperty("备注")
private String rem;
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "31322")
@ExcelProperty("主键")
private Integer id;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "借用部门")
@ExcelProperty("借用部门")
private Integer jyBm;
@Schema(description = "借用用途")
@ExcelProperty("借用用途")
private String jyYt;
@Schema(description = "备注")
@ExcelProperty("备注")
private String rem;
@Schema(description = "借用物料名称")
@ExcelProperty("借用物料名称")
private Integer jyMaster;
private String jyMaster;
@Schema(description = "借用人")
@ExcelProperty("借用人")
private Long jyUser;
@Schema(description = "借用类型", example = "1")
@ExcelProperty("借用类型")
private String jyType;
@Schema(description = "数量")
@ExcelProperty("数量")
private BigDecimal num;
@Schema(description = "借用日期")
@ExcelProperty("借用日期")
private LocalDateTime jyDate;
@Schema(description = "借用人")
@ExcelProperty("借用人")
private String jyUsers;
@Schema(description = "借用部门")
@ExcelProperty("借用部门")
private String jyBms;
@Schema(description = "借用物料名称")
@ExcelProperty("借用物料名称")
private String jyMasters;
@Schema(description = "借用物料名称")
private String jyMasterName;
}

View File

@ -1,5 +1,7 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.master.vo;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.master.MasterDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.masterline.MasterLineDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
@ -38,6 +40,8 @@ public class MasterSaveReqVO {
private BigDecimal num;
@Schema(description = "借用时间")
private LocalDateTime jyDate;
@Schema(description = "借用物料明细")
private List<MasterLineDO> jyDetails;
}

View File

@ -0,0 +1,102 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.masterline;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.CommonResult;
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success;
import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils;
import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog;
import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.masterline.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.masterline.MasterLineDO;
import com.chanko.yunxi.mes.module.heli.service.masterline.MasterLineService;
@Tag(name = "管理后台 - 借用行")
@RestController
@RequestMapping("/heli/master-line")
@Validated
public class MasterLineController {
@Resource
private MasterLineService masterLineService;
@PostMapping("/create")
@Operation(summary = "创建借用行")
@PreAuthorize("@ss.hasPermission('heli:master-line:create')")
public CommonResult<Integer> createMasterLine(@Valid @RequestBody MasterLineSaveReqVO createReqVO) {
return success(masterLineService.createMasterLine(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新借用行")
@PreAuthorize("@ss.hasPermission('heli:master-line:update')")
public CommonResult<Boolean> updateMasterLine(@Valid @RequestBody MasterLineSaveReqVO updateReqVO) {
masterLineService.updateMasterLine(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除借用行")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('heli:master-line:delete')")
public CommonResult<Boolean> deleteMasterLine(@RequestParam("id") Integer id) {
masterLineService.deleteMasterLine(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得借用行")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('heli:master-line:query')")
public CommonResult<MasterLineRespVO> getMasterLine(@RequestParam("id") Integer id) {
MasterLineDO masterLine = masterLineService.getMasterLine(id);
return success(BeanUtils.toBean(masterLine, MasterLineRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得借用行分页")
@PreAuthorize("@ss.hasPermission('heli:master-line:query')")
public CommonResult<PageResult<MasterLineRespVO>> getMasterLinePage(@Valid MasterLinePageReqVO pageReqVO) {
PageResult<MasterLineDO> pageResult = masterLineService.getMasterLinePage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MasterLineRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出借用行 Excel")
@PreAuthorize("@ss.hasPermission('heli:master-line:export')")
@OperateLog(type = EXPORT)
public void exportMasterLineExcel(@Valid MasterLinePageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<MasterLineDO> list = masterLineService.getMasterLinePage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "借用行.xls", "数据", MasterLineRespVO.class,
BeanUtils.toBean(list, MasterLineRespVO.class));
}
@GetMapping("/getByMasterId")
@Operation(summary = "获得借用行")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('heli:master-line:query')")
public CommonResult<List<MasterLineDO>> getByMasterId(@RequestParam("id") Integer id) {
List<MasterLineDO> list = masterLineService.getByMasterId(id);
return success(list);
}
}

View File

@ -0,0 +1,37 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.masterline.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.chanko.yunxi.mes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 借用行分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MasterLinePageReqVO extends PageParam {
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "借用id", example = "2559")
private Integer jyId;
@Schema(description = "借用物料")
private String jyMaster;
@Schema(description = "借用数量")
private String jyNum;
@Schema(description = "备注")
private String rem;
@Schema(description = "物料id", example = "22466")
private Long matId;
}

View File

@ -0,0 +1,44 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.masterline.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 借用行 Response VO")
@Data
@ExcelIgnoreUnannotated
public class MasterLineRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "25113")
@ExcelProperty("主键")
private Integer id;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "借用id", example = "2559")
@ExcelProperty("借用id")
private Integer jyId;
@Schema(description = "借用物料")
@ExcelProperty("借用物料")
private String jyMaster;
@Schema(description = "借用数量")
@ExcelProperty("借用数量")
private String jyNum;
@Schema(description = "备注")
@ExcelProperty("备注")
private String rem;
@Schema(description = "物料id", example = "22466")
@ExcelProperty("物料id")
private Long matId;
}

View File

@ -0,0 +1,31 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.masterline.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
import java.util.*;
@Schema(description = "管理后台 - 借用行新增/修改 Request VO")
@Data
public class MasterLineSaveReqVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "25113")
private Integer id;
@Schema(description = "借用id", example = "2559")
private Integer jyId;
@Schema(description = "借用物料")
private String jyMaster;
@Schema(description = "借用数量")
private String jyNum;
@Schema(description = "备注")
private String rem;
@Schema(description = "物料id", example = "22466")
private Long matId;
}

View File

@ -1,5 +1,7 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.material;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.chanko.yunxi.mes.framework.common.pojo.CommonResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
@ -16,6 +18,7 @@ import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storageinventory.StorageInventoryDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagelogNow.StorageLogNowDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagelogNow.StorageMaterialDO;
import com.chanko.yunxi.mes.module.heli.dal.mysql.material.MaterialMapper;
import com.chanko.yunxi.mes.module.heli.service.material.MaterialService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@ -44,11 +47,16 @@ public class MaterialController {
@Resource
private MaterialService materialService;
@Resource
private MaterialMapper materialMapper;
@PostMapping("/create")
@Operation(summary = "创建物料")
@PreAuthorize("@ss.hasPermission('heli:material:create')")
public CommonResult<Long> createMaterial(@Valid @RequestBody MaterialSaveReqVO createReqVO) {
if (ObjectUtil.isNotEmpty(materialService.getMaterialId(createReqVO.getCode()))){
return CommonResult.error(400,"物料编码"+createReqVO.getCode()+"已存在");
}
return success(materialService.createMaterial(createReqVO));
}
@ -56,6 +64,12 @@ public class MaterialController {
@Operation(summary = "更新物料")
@PreAuthorize("@ss.hasPermission('heli:material:update')")
public CommonResult<Boolean> updateMaterial(@Valid @RequestBody MaterialSaveReqVO updateReqVO) {
LambdaQueryWrapper<MaterialDO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(MaterialDO::getCode, updateReqVO.getCode());
queryWrapper.ne(MaterialDO::getId, updateReqVO.getId());
if (ObjectUtil.isNotEmpty(materialMapper.selectOne(queryWrapper))){
return CommonResult.error(400,"物料编码"+updateReqVO.getCode()+"已存在");
}
materialService.updateMaterial(updateReqVO);
return success(true);
}

View File

@ -18,10 +18,12 @@ import com.chanko.yunxi.mes.module.heli.dal.dataobject.purchaseorder.PurchaseOrd
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storage.StorageDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatchDO;
import com.chanko.yunxi.mes.module.heli.dal.mysql.orderys.OrderYsMapper;
import com.chanko.yunxi.mes.module.heli.dal.mysql.processbom.ProcessBomDetailMapper;
import com.chanko.yunxi.mes.module.heli.enums.BusinesTypeEnum;
import com.chanko.yunxi.mes.module.heli.manager.CrossOrderManager;
import com.chanko.yunxi.mes.module.heli.service.deliverorder.DeliverOrderService;
import com.chanko.yunxi.mes.module.heli.service.orderys.OrderYsService;
import com.chanko.yunxi.mes.module.heli.service.processbom.ProcessBomService;
import com.chanko.yunxi.mes.module.heli.service.projectorder.ProjectOrderService;
import com.chanko.yunxi.mes.module.heli.service.purchaseorder.PurchaseOrderService;
import com.chanko.yunxi.mes.module.heli.service.storage.StorageService;
@ -66,13 +68,9 @@ public class ProjectOrderController {
@Resource
private OrderYsService orderYsService;
@Resource
private ProcessBomService processBomService;
@Resource
private DeliverOrderService deliverOrderService;
@Resource
private TaskDispatchService taskDispatchService;
@Resource
private StorageService storageService;
@Resource
private PurchaseOrderService purchaseOrderService;
@PostMapping("/create")
@Operation(summary = "创建项目订单")
@PreAuthorize("@ss.hasPermission('heli:project-order:create')")
@ -155,6 +153,27 @@ public class ProjectOrderController {
public CommonResult<PageResult<ProjectOrderCostRespVO>> getProjectOrderCostPage(@Valid ProjectOrderCostPageReqVO pageReqVO) {
PageResult<ProjectOrderDO> pageResult = projectOrderService.getProjectOrderCostPage(pageReqVO);
for (ProjectOrderDO projectOrderDO :pageResult.getList()) {
//标准件成本
BigDecimal standardPartsCost;
standardPartsCost=processBomService.StandardPartsCost(projectOrderDO.getId(),projectOrderDO.getProjectSubId());
projectOrderDO.setBiaoZhunJianCost(standardPartsCost);
//材料成本
BigDecimal materialCost;
materialCost=processBomService.materialCost(projectOrderDO.getId(),projectOrderDO.getProjectSubId());
projectOrderDO.setCailiaoCost(materialCost);
//外协加工费
BigDecimal outsourcedProcessingFee;
outsourcedProcessingFee=processBomService.outsourcedProcessingFee(projectOrderDO.getId(),projectOrderDO.getProjectSubId());
projectOrderDO.setWaixeiCost(outsourcedProcessingFee);
//内部工时费
BigDecimal internalLaborCost;
internalLaborCost=processBomService.internalLaborCost(projectOrderDO.getId(),projectOrderDO.getProjectSubId());
projectOrderDO.setNeibuCost(internalLaborCost);
//运费成本
List<DeliverOrderDO> deliverOrderDO = deliverOrderService.getListYf(projectOrderDO.getId(),projectOrderDO.getProjectSubId());
if (deliverOrderDO!=null&&deliverOrderDO.size()>0){
BigDecimal totalAmount = deliverOrderDO.stream()
@ -164,34 +183,26 @@ public class ProjectOrderController {
}else {
projectOrderDO.setYunFeiCost(BigDecimal.ZERO);
}
List<TaskDispatchDO> list= taskDispatchService.getListJg(projectOrderDO.getId(),projectOrderDO.getProjectSubId());
if (list!=null&&list.size()>0){
BigDecimal totalAmount = list.stream()
.map(TaskDispatchDO -> TaskDispatchDO.getZanGuMoney() != null ?new BigDecimal(TaskDispatchDO.getZanGuMoney()) : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add);
projectOrderDO.setJiaGongShiCost(totalAmount);
}else {
projectOrderDO.setJiaGongShiCost(BigDecimal.ZERO);
}
List<StorageDO> list1= storageService.getList(projectOrderDO.getId(),projectOrderDO.getProjectSubId());
if (list1!=null&&list1.size()>0){
BigDecimal totalAmount = list1.stream()
.map(StorageDO -> StorageDO.getCaiGouMoney() != null ?StorageDO.getCaiGouMoney() : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add);
projectOrderDO.setBiaoZhunJianCost(totalAmount);
}else {
projectOrderDO.setBiaoZhunJianCost(BigDecimal.ZERO);
}
List<PurchaseOrderDO> list2 =purchaseOrderService.getListqt(projectOrderDO.getId(),projectOrderDO.getProjectSubId());
if (list2!=null&&list2.size()>0){
BigDecimal totalAmount = list2.stream()
.map(PurchaseOrderDO -> PurchaseOrderDO.getCaiGouMoney() != null ?PurchaseOrderDO.getCaiGouMoney() : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add);
projectOrderDO.setQitaCost(totalAmount);
}else {
projectOrderDO.setQitaCost(BigDecimal.ZERO);
}
BigDecimal sum = projectOrderDO.getYunFeiCost().add(projectOrderDO.getJiaGongShiCost()).add(projectOrderDO.getBiaoZhunJianCost()).add(projectOrderDO.getQitaCost());
// List<TaskDispatchDO> list= taskDispatchService.getListJg(projectOrderDO.getId(),projectOrderDO.getProjectSubId());
// if (list!=null&&list.size()>0){
// BigDecimal totalAmount = list.stream()
// .map(TaskDispatchDO -> TaskDispatchDO.getZanGuMoney() != null ?new BigDecimal(TaskDispatchDO.getZanGuMoney()) : BigDecimal.ZERO)
// .reduce(BigDecimal.ZERO, BigDecimal::add);
// projectOrderDO.setJiaGongShiCost(totalAmount);
// }else {
// projectOrderDO.setJiaGongShiCost(BigDecimal.ZERO);
// }
// List<PurchaseOrderDO> list2 =purchaseOrderService.getListqt(projectOrderDO.getId(),projectOrderDO.getProjectSubId());
// if (list2!=null&&list2.size()>0){
// BigDecimal totalAmount = list2.stream()
// .map(PurchaseOrderDO -> PurchaseOrderDO.getCaiGouMoney() != null ?PurchaseOrderDO.getCaiGouMoney() : BigDecimal.ZERO)
// .reduce(BigDecimal.ZERO, BigDecimal::add);
// projectOrderDO.setQitaCost(totalAmount);
// }else {
// projectOrderDO.setQitaCost(BigDecimal.ZERO);
// }
BigDecimal sum = projectOrderDO.getYunFeiCost().add(projectOrderDO.getCailiaoCost()).add(projectOrderDO.getBiaoZhunJianCost()).add(projectOrderDO.getNeibuCost()).add(projectOrderDO.getWaixeiCost());
projectOrderDO.setSumCost(sum);
}
return success(BeanUtils.toBean(pageResult, ProjectOrderCostRespVO.class));

View File

@ -57,11 +57,11 @@ public class ProjectOrderCostRespVO {
@Schema(description = "外协加工费用")
@ExcelProperty("外协加工费用")
private BigDecimal waiXieCost;
private BigDecimal waixeiCost;
@Schema(description = "加工工时换算成本")
@ExcelProperty("加工工时换算成本")
private BigDecimal jiaGongShiCost;
@Schema(description = "内部加工成本")
@ExcelProperty("内部加工成本")
private BigDecimal neibuCost;
@Schema(description = "运费成本")
@ExcelProperty("运费成本")
private BigDecimal yunFeiCost;
@ -69,6 +69,8 @@ public class ProjectOrderCostRespVO {
@ExcelProperty("合计成本")
private BigDecimal sumCost;
@ExcelProperty("其他成本")
private BigDecimal qitaCost;
private BigDecimal cailiaoCost;
@Schema(description = "设备型号", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
@ExcelProperty("设备型号")
private String deviceModel;
}

View File

@ -0,0 +1,74 @@
package com.chanko.yunxi.mes.module.heli.dal.dataobject.masterline;
import lombok.*;
import java.math.BigDecimal;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO;
/**
* 借用行 DO
*
* @author 管理员
*/
@TableName("jy_master_line")
@KeySequence("jy_master_line_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class MasterLineDO extends BaseDO {
/**
* 主键
*/
@TableId
private Integer id;
/**
* 借用id
*/
private Integer jyId;
/**
* 借用物料
*/
private String jyMaster;
/**
* 借用数量
*/
private String jyNum;
/**
* 备注
*/
private String rem;
/**
* 物料id
*/
private Long matId;
@TableField(exist = false)
private String jyUsers;
@TableField(exist = false)
private String jyBms;
@TableField(exist = false)
private String jyTypes;
@TableField(exist = false)
private String jyMasters;
@TableField(exist = false)
private String jyMasterName;
@TableField(exist = false)
private BigDecimal quantityLent;
@TableField(exist = false)
private String jyYt;
@TableField(exist = false)
private LocalDateTime jyDate;
@TableField(exist = false)
private String rems;
}

View File

@ -271,6 +271,8 @@ public class ProjectOrderDO extends BaseDO {
@TableField(exist = false)
private int projectYear;
@TableField(exist = false)
private String deviceModel;
@TableField(exist = false)
private Long projectSubId;
@ -280,17 +282,19 @@ public class ProjectOrderDO extends BaseDO {
@TableField(exist = false)
private String unitName;
@TableField(exist = false)
private BigDecimal cailiaoCost;
/*
* 运费成本
* */
@TableField(exist = false)
private BigDecimal yunFeiCost;
@TableField(exist = false)
private BigDecimal jiaGongShiCost;
private BigDecimal neibuCost;
@TableField(exist = false)
private BigDecimal biaoZhunJianCost;
@TableField(exist = false)
private BigDecimal qitaCost;
private BigDecimal waixeiCost;
@TableField(exist = false)
private BigDecimal sumCost;
/**

View File

@ -7,6 +7,7 @@ import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.master.MasterDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.masterline.MasterLineDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.plan.PlanDO;
import com.chanko.yunxi.mes.module.system.dal.dataobject.dept.DeptDO;
@ -28,10 +29,14 @@ public interface MasterMapper extends BaseMapperX<MasterDO> {
MPJLambdaWrapper<MasterDO> query = new MPJLambdaWrapper<>();
query.selectAll(MasterDO.class)
.select("b.nickname as jyUsers,c.name as jyBms,d.name as jyMasters")
.leftJoin(MasterLineDO.class, "a", MasterLineDO::getJyId, MasterDO::getId)
.leftJoin(AdminUserDO.class,"b",AdminUserDO::getId,MasterDO::getJyUser)
.leftJoin(DeptDO.class,"c",DeptDO::getId,MasterDO::getJyBm)
.leftJoin(MaterialDO.class,"d",MaterialDO::getId,MasterDO::getJyMaster)
.leftJoin(MaterialDO.class,"d",MaterialDO::getId,MasterLineDO::getMatId)
.disableSubLogicDel()
.groupBy(MasterDO::getId)
.orderByDesc(MasterDO::getId);
query.eq(!ObjectUtil.isEmpty(reqVO.getJyYt()), MasterDO::getJyYt, reqVO.getJyYt())
.eq(!ObjectUtil.isEmpty(reqVO.getJyType()), MasterDO::getJyType, reqVO.getJyType())
.like(!ObjectUtil.isEmpty(reqVO.getJyBm()), DeptDO::getName, reqVO.getJyBm())
@ -40,4 +45,5 @@ public interface MasterMapper extends BaseMapperX<MasterDO> {
return selectPage(reqVO,query);
}
}

View File

@ -0,0 +1,59 @@
package com.chanko.yunxi.mes.module.heli.dal.mysql.masterline;
import java.util.*;
import cn.hutool.core.util.ObjectUtil;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX;
import com.chanko.yunxi.mes.module.heli.controller.admin.master.vo.MasterPageReqVO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.master.MasterDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.masterline.MasterLineDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO;
import com.chanko.yunxi.mes.module.system.dal.dataobject.dept.DeptDO;
import com.chanko.yunxi.mes.module.system.dal.dataobject.user.AdminUserDO;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.ibatis.annotations.Mapper;
import com.chanko.yunxi.mes.module.heli.controller.admin.masterline.vo.*;
/**
* 借用行 Mapper
*
* @author 管理员
*/
@Mapper
public interface MasterLineMapper extends BaseMapperX<MasterLineDO> {
default PageResult<MasterLineDO> selectPage(MasterLinePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<MasterLineDO>()
.betweenIfPresent(MasterLineDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(MasterLineDO::getJyId, reqVO.getJyId())
.eqIfPresent(MasterLineDO::getJyMaster, reqVO.getJyMaster())
.eqIfPresent(MasterLineDO::getJyNum, reqVO.getJyNum())
.eqIfPresent(MasterLineDO::getRem, reqVO.getRem())
.eqIfPresent(MasterLineDO::getMatId, reqVO.getMatId())
.orderByDesc(MasterLineDO::getId));
}
default PageResult<MasterLineDO> getMasterLinePage(MasterPageReqVO pageReqVO){
MPJLambdaWrapper<MasterLineDO> query = new MPJLambdaWrapper<>();
query.selectAll(MasterLineDO.class)
.select("b.nickname as jyUsers,c.name as jyBms,d.name as jyMasters,a.jy_type as jyTypes")
.select("a.jy_yt as jyYt","a.jy_date as jyDate")
.select("a.rem as rems")
.leftJoin(MasterDO.class,"a",MasterDO::getId,MasterLineDO::getJyId)
.leftJoin(AdminUserDO.class,"b",AdminUserDO::getId,MasterDO::getJyUser)
.leftJoin(DeptDO.class,"c",DeptDO::getId,MasterDO::getJyBm)
.leftJoin(MaterialDO.class,"d",MaterialDO::getId,MasterLineDO::getMatId)
.disableSubLogicDel()
.groupBy(MasterLineDO::getId)
.orderByDesc(MasterLineDO::getId);
query.eq(!ObjectUtil.isEmpty(pageReqVO.getJyYt()), MasterDO::getJyYt, pageReqVO.getJyYt())
.eq(!ObjectUtil.isEmpty(pageReqVO.getJyType()), MasterDO::getJyType, pageReqVO.getJyType())
.like(!ObjectUtil.isEmpty(pageReqVO.getJyBm()), DeptDO::getName, pageReqVO.getJyBm())
.like(!ObjectUtil.isEmpty(pageReqVO.getJyMaster()), MaterialDO::getName, pageReqVO.getJyMaster())
.like(!ObjectUtil.isEmpty(pageReqVO.getJyUser()), AdminUserDO::getNickname, pageReqVO.getJyUser());
return selectPage(pageReqVO,query);
}
}

View File

@ -17,6 +17,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.util.StringUtils;
import java.math.BigDecimal;
import java.util.List;
/**
@ -184,4 +185,14 @@ public interface ProcessBomMapper extends BaseMapperX<ProcessBomDO> {
}
List<ProcessBomDO> getProcessBomPagesall();
PlanDO getplanid(Long id);
BigDecimal StandardPartsCost(@Param("id") Long id,@Param("projectSubId") Long projectSubId);
BigDecimal materialCost(@Param("id") Long id,@Param("projectSubId") Long projectSubId);
BigDecimal outsourcedProcessingFee(@Param("id") Long id,@Param("projectSubId") Long projectSubId);
BigDecimal bubbleFees(@Param("id") Long id,@Param("projectSubId") Long projectSubId);
BigDecimal internalLaborCost(@Param("id") Long id,@Param("projectSubId") Long projectSubId);
}

View File

@ -6,6 +6,7 @@ import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX;
import com.chanko.yunxi.mes.module.heli.controller.admin.projectorder.vo.ProjectOrderCostPageReqVO;
import com.chanko.yunxi.mes.module.heli.controller.admin.projectorder.vo.ProjectOrderPageReqVO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.customer.CustomerDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.equip.EquipDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.plan.PlanDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderSubDO;
@ -41,9 +42,10 @@ public interface ProjectOrderMapper extends BaseMapperX<ProjectOrderDO> {
MPJLambdaWrapper<ProjectOrderDO> query = new MPJLambdaWrapper<>();
query.selectAll(ProjectOrderDO.class)
.select("a.id as projectSubId,a.name as projectSubName")
.select("b.name as customerName")
.select("b.name as customerName,e.name as deviceModel")
.leftJoin(ProjectOrderSubDO.class,"a",ProjectOrderSubDO::getProjectOrderId,ProjectOrderDO::getId)
.leftJoin(CustomerDO.class,"b",CustomerDO::getId,ProjectOrderDO::getCustomerId)
.leftJoin(EquipDO.class,"e",EquipDO::getId,ProjectOrderSubDO::getDeviceModel)
.like(!StringUtils.isEmpty(reqVO.getCode()),ProjectOrderDO::getCode,reqVO.getCode())
.like(!StringUtils.isEmpty(reqVO.getProjectName()),ProjectOrderDO::getProjectName,reqVO.getProjectName())
.like(!StringUtils.isEmpty(reqVO.getCustomerName()),"b.name",reqVO.getCustomerName())

View File

@ -1,5 +1,6 @@
package com.chanko.yunxi.mes.module.heli.dal.mysql.storage;
import java.math.BigDecimal;
import java.util.*;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
@ -17,6 +18,7 @@ import com.chanko.yunxi.mes.module.system.dal.dataobject.user.AdminUserDO;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.ibatis.annotations.Mapper;
import com.chanko.yunxi.mes.module.heli.controller.admin.storage.vo.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.util.StringUtils;
/**
@ -93,4 +95,6 @@ public interface StorageMapper extends BaseMapperX<StorageDO> {
.ne(StorageDO::getStatus,3);
return selectList(query);
}
BigDecimal StandardPartsCost(@Param("id") Long id, @Param("projectSubId") Long projectSubId);
}

View File

@ -14,6 +14,7 @@ import com.chanko.yunxi.mes.module.heli.dal.dataobject.processbom.ProcessBomDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderSubDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.serialnumber.SerialNumberDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storageinventory.StorageInventoryDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagemat.StorageMatDO;
import com.chanko.yunxi.mes.module.heli.dal.mysql.deliverorder.DeliverOrderMapper;
import com.chanko.yunxi.mes.module.heli.dal.mysql.deliverorder.DeliverOrderSubMapper;
@ -343,11 +344,17 @@ public class DeliverOrderServiceImpl implements DeliverOrderService {
wrapper.eq(DeliverOrderDO::getDeliverStatus,2);
wrapper.orderByDesc(DeliverOrderDO::getDeliverDate);
List<DeliverOrderDO> deliverOrderDOS = deliverOrderMapper.selectList(wrapper);
if (deliverOrderDOS!=null&&deliverOrderDOS.size()>0){
LambdaQueryWrapper<ProjectOrderSubDO> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(ProjectOrderSubDO::getProjectOrderId,id);
List<ProjectOrderSubDO> projectOrderSubDOS = projectOrderSubMapper.selectList(queryWrapper1);
if (deliverOrderDOS!=null&&deliverOrderDOS.size()>0&&projectOrderSubDOS!=null&&projectOrderSubDOS.size()>0){
List<Long> ids = projectOrderSubDOS.stream()
.map(ProjectOrderSubDO::getId)
.collect(Collectors.toList());
for (DeliverOrderDO deliverOrderDO : deliverOrderDOS) {
LambdaQueryWrapper<DeliverOrderSubDO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DeliverOrderSubDO::getDeliveryOrderId,deliverOrderDO.getId());
queryWrapper.eq(DeliverOrderSubDO::getSaleOrderSubId,projectSubId);
queryWrapper.in(DeliverOrderSubDO::getSaleOrderSubId,ids);
List<DeliverOrderSubDO> deliverOrderSubDOS = deliverOrderSubMapper.selectList(queryWrapper);
BigDecimal totalAmount = deliverOrderSubDOS.stream()
.map(deliverOrderSubDO -> deliverOrderSubDO.getYunFei() != null ? deliverOrderSubDO.getYunFei() : BigDecimal.ZERO)

View File

@ -6,6 +6,7 @@ import com.chanko.yunxi.mes.module.heli.controller.admin.master.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.master.MasterDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.masterline.MasterLineDO;
/**
* 借用主 Service 接口
@ -52,4 +53,5 @@ public interface MasterService {
*/
PageResult<MasterDO> getMasterPage(MasterPageReqVO pageReqVO);
PageResult<MasterLineDO> getMasterLinePage(MasterPageReqVO pageReqVO);
}

View File

@ -1,11 +1,17 @@
package com.chanko.yunxi.mes.module.heli.service.master;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.masterline.MasterLineDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.orderysdetail.OrderYsDetailDO;
import com.chanko.yunxi.mes.module.heli.dal.mysql.masterline.MasterLineMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
import com.chanko.yunxi.mes.module.heli.controller.admin.master.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.master.MasterDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
@ -28,12 +34,16 @@ public class MasterServiceImpl implements MasterService {
@Resource
private MasterMapper masterMapper;
@Resource
private MasterLineMapper masterLineMapper;
@Override
public Integer createMaster(MasterSaveReqVO createReqVO) {
// 插入
MasterDO master = BeanUtils.toBean(createReqVO, MasterDO.class);
masterMapper.insert(master);
createReqVO.getJyDetails().forEach(detail -> detail.setJyId(master.getId()));
masterLineMapper.insertBatch(createReqVO.getJyDetails());
// 返回
return master.getId();
}
@ -45,14 +55,24 @@ public class MasterServiceImpl implements MasterService {
// 更新
MasterDO updateObj = BeanUtils.toBean(updateReqVO, MasterDO.class);
masterMapper.updateById(updateObj);
updateReqVO.getJyDetails().forEach(detail -> detail.setJyId(updateObj.getId()));
createOrUpdateJyDetails(updateReqVO.getJyDetails());
}
private void createOrUpdateJyDetails(List<MasterLineDO> JyDetails) {
// 分组更新与插入
List<MasterLineDO> updateList = JyDetails.stream().filter(o -> o.getId() != null).collect(Collectors.toList());
List<MasterLineDO> insertList = JyDetails.stream().filter(o -> o.getId() == null).collect(Collectors.toList());
if(!updateList.isEmpty()) masterLineMapper.updateBatch(updateList);
if(!insertList.isEmpty()) masterLineMapper.insertBatch(insertList);
}
@Override
public void deleteMaster(Integer id) {
// 校验存在
validateMasterExists(id);
// 删除
masterMapper.deleteById(id);
masterLineMapper.delete(new UpdateWrapper<MasterLineDO>().lambda().eq(MasterLineDO::getJyId, id));
}
private void validateMasterExists(Integer id) {
@ -71,4 +91,9 @@ public class MasterServiceImpl implements MasterService {
return masterMapper.selectPage(pageReqVO);
}
@Override
public PageResult<MasterLineDO> getMasterLinePage(MasterPageReqVO pageReqVO) {
return masterLineMapper.getMasterLinePage(pageReqVO);
}
}

View File

@ -0,0 +1,56 @@
package com.chanko.yunxi.mes.module.heli.service.masterline;
import java.util.*;
import javax.validation.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.masterline.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.masterline.MasterLineDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
/**
* 借用行 Service 接口
*
* @author 管理员
*/
public interface MasterLineService {
/**
* 创建借用行
*
* @param createReqVO 创建信息
* @return 编号
*/
Integer createMasterLine(@Valid MasterLineSaveReqVO createReqVO);
/**
* 更新借用行
*
* @param updateReqVO 更新信息
*/
void updateMasterLine(@Valid MasterLineSaveReqVO updateReqVO);
/**
* 删除借用行
*
* @param id 编号
*/
void deleteMasterLine(Integer id);
/**
* 获得借用行
*
* @param id 编号
* @return 借用行
*/
MasterLineDO getMasterLine(Integer id);
/**
* 获得借用行分页
*
* @param pageReqVO 分页查询
* @return 借用行分页
*/
PageResult<MasterLineDO> getMasterLinePage(MasterLinePageReqVO pageReqVO);
List<MasterLineDO> getByMasterId(Integer id);
}

View File

@ -0,0 +1,80 @@
package com.chanko.yunxi.mes.module.heli.service.masterline;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.masterline.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.masterline.MasterLineDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
import com.chanko.yunxi.mes.module.heli.dal.mysql.masterline.MasterLineMapper;
import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*;
/**
* 借用行 Service 实现类
*
* @author 管理员
*/
@Service
@Validated
public class MasterLineServiceImpl implements MasterLineService {
@Resource
private MasterLineMapper masterLineMapper;
@Override
public Integer createMasterLine(MasterLineSaveReqVO createReqVO) {
// 插入
MasterLineDO masterLine = BeanUtils.toBean(createReqVO, MasterLineDO.class);
masterLineMapper.insert(masterLine);
// 返回
return masterLine.getId();
}
@Override
public void updateMasterLine(MasterLineSaveReqVO updateReqVO) {
// 校验存在
validateMasterLineExists(updateReqVO.getId());
// 更新
MasterLineDO updateObj = BeanUtils.toBean(updateReqVO, MasterLineDO.class);
masterLineMapper.updateById(updateObj);
}
@Override
public void deleteMasterLine(Integer id) {
// 校验存在
validateMasterLineExists(id);
// 删除
masterLineMapper.deleteById(id);
}
private void validateMasterLineExists(Integer id) {
if (masterLineMapper.selectById(id) == null) {
throw exception(MASTER_LINE_NOT_EXISTS);
}
}
@Override
public MasterLineDO getMasterLine(Integer id) {
return masterLineMapper.selectById(id);
}
@Override
public PageResult<MasterLineDO> getMasterLinePage(MasterLinePageReqVO pageReqVO) {
return masterLineMapper.selectPage(pageReqVO);
}
@Override
public List<MasterLineDO> getByMasterId(Integer id) {
return masterLineMapper.selectList(new LambdaQueryWrapper<MasterLineDO>().eq(MasterLineDO::getJyId,id));
}
}

View File

@ -97,24 +97,24 @@ public class MaterialServiceImpl implements MaterialService {
// 插入
MaterialDO material = BeanUtils.toBean(createReqVO, MaterialDO.class);
MaterialTypeEnum materialType = MaterialTypeEnum.getMaterialType(material.getMaterialType());
SerialNumberDO serialNumberDO = serialNumberService.getSerialNumber(MATERIAL.name(), materialType.getPrefix());
Long serialNumber = serialNumberDO.getSerialNumber();
// 个位数不满5直接到5 满5到10
String serialNumberStr = String.valueOf(serialNumber);
int serialLength = serialNumberStr.length();
String prefix = serialNumberStr.substring(0, serialLength - 1);
String suffix = serialNumberStr.substring(serialLength-1);
long digit = Long.parseLong(suffix);
digit = digit < 5 ? 5 : 10;
serialNumber = Long.parseLong(prefix+"0") + digit;
serialNumberDO.setSerialNumber(serialNumber);
material.setCode(CodeEnum.MATERIAL.getCode(materialType.getPrefix(), serialNumber.toString()));
// MaterialTypeEnum materialType = MaterialTypeEnum.getMaterialType(material.getMaterialType());
// SerialNumberDO serialNumberDO = serialNumberService.getSerialNumber(MATERIAL.name(), materialType.getPrefix());
// Long serialNumber = serialNumberDO.getSerialNumber();
// // 个位数不满5直接到5 满5到10
// String serialNumberStr = String.valueOf(serialNumber);
// int serialLength = serialNumberStr.length();
// String prefix = serialNumberStr.substring(0, serialLength - 1);
// String suffix = serialNumberStr.substring(serialLength-1);
// long digit = Long.parseLong(suffix);
// digit = digit < 5 ? 5 : 10;
// serialNumber = Long.parseLong(prefix+"0") + digit;
// serialNumberDO.setSerialNumber(serialNumber);
//
// material.setCode(CodeEnum.MATERIAL.getCode(materialType.getPrefix(), serialNumber.toString()));
materialMapper.insert(material);
// 回写序列记录
serialNumberService.updateSerialNumber(serialNumberDO);
// serialNumberService.updateSerialNumber(serialNumberDO);
// 返回
return material.getId();

View File

@ -12,6 +12,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@ -102,4 +103,12 @@ public interface ProcessBomService {
PageResult<ProcessBomDetailDO> planBbPage(TaskPlanJDBaoBiaoPageReqVO pageReqVO);
PageResult<ProcessBomDetailDO> planBZJPage(TaskPlanJDBaoBiaoPageReqVO pageReqVO);
BigDecimal StandardPartsCost(Long id, Long projectSubId);
BigDecimal materialCost(Long id, Long projectSubId);
BigDecimal outsourcedProcessingFee(Long id, Long projectSubId);
BigDecimal internalLaborCost(Long id, Long projectSubId);
}

View File

@ -33,6 +33,7 @@ import com.chanko.yunxi.mes.module.heli.dal.dataobject.plantask.PlanTaskDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.plantaskbom.PlanTaskBomDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.processbom.ProcessBomDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.processbom.ProcessBomDetailDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.purchaseordermakedetail.PurchaseOrderMakeDetailDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.serialnumber.SerialNumberDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.shenhe.ShenheDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagelogNow.StorageLogNowDO;
@ -47,7 +48,9 @@ import com.chanko.yunxi.mes.module.heli.dal.mysql.plan.PlanMapper;
import com.chanko.yunxi.mes.module.heli.dal.mysql.plantask.PlanTaskMapper;
import com.chanko.yunxi.mes.module.heli.dal.mysql.processbom.ProcessBomDetailMapper;
import com.chanko.yunxi.mes.module.heli.dal.mysql.processbom.ProcessBomMapper;
import com.chanko.yunxi.mes.module.heli.dal.mysql.purchaseordermakedetail.PurchaseOrderMakeDetailMapper;
import com.chanko.yunxi.mes.module.heli.dal.mysql.shenhe.ShenheMapper;
import com.chanko.yunxi.mes.module.heli.dal.mysql.storage.StorageMapper;
import com.chanko.yunxi.mes.module.heli.dal.mysql.storagelog.StorageLogNowMapper;
import com.chanko.yunxi.mes.module.heli.dal.mysql.taskdispatch.TaskDispatchDetailMapper;
import com.chanko.yunxi.mes.module.heli.dal.mysql.taskreport.TaskReportMapper;
@ -141,6 +144,10 @@ public class ProcessBomServiceImpl implements ProcessBomService {
private TaskReportMapper taskReportMapper;
@Resource
private BgMasterLineMapper bgMasterLineMapper;
@Resource
private StorageMapper storageMapper;
@Resource
private PurchaseOrderMakeDetailMapper purchaseOrderMakeDetailMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public Long createProcessBom(ProcessBomSaveReqVO createReqVO) {
@ -1273,6 +1280,50 @@ public class ProcessBomServiceImpl implements ProcessBomService {
return processBomDetailMapper.planBZJPage(pageReqVO);
}
@Override
public BigDecimal StandardPartsCost(Long id, Long projectSubId) {
BigDecimal cost=processBomMapper.StandardPartsCost(id,projectSubId);
BigDecimal cost1=storageMapper.StandardPartsCost(id,projectSubId);
if (ObjectUtil.isEmpty(cost)) cost=BigDecimal.ZERO;
if (ObjectUtil.isEmpty(cost1)) cost1=BigDecimal.ZERO;
return cost.add(cost1);
}
@Override
public BigDecimal materialCost(Long id, Long projectSubId) {
// LambdaQueryWrapper<PurchaseOrderMakeDetailDO> wrapper = new LambdaQueryWrapper<>();
// wrapper.eq(PurchaseOrderMakeDetailDO::getProjectPlanSubId, projectSubId);
// wrapper.eq(PurchaseOrderMakeDetailDO::getIsFoam,"Y");
// List<PurchaseOrderMakeDetailDO> purchaseOrderMakeDetailDOS = purchaseOrderMakeDetailMapper.selectList(wrapper);
// BigDecimal cost=BigDecimal.ZERO;
// if (purchaseOrderMakeDetailDOS!=null&&purchaseOrderMakeDetailDOS.size()>0) {
// cost = purchaseOrderMakeDetailDOS.stream()
// .map(purchaseOrderMakeDetailDO -> purchaseOrderMakeDetailDO.getFoamPrice() != null ? purchaseOrderMakeDetailDO.getFoamPrice() : BigDecimal.ZERO)
// .reduce(BigDecimal.ZERO, BigDecimal::add);
// }
BigDecimal cost= processBomMapper.bubbleFees(id,projectSubId);
BigDecimal cost1=processBomMapper.materialCost(id,projectSubId);
if (ObjectUtil.isEmpty(cost1)) cost1=BigDecimal.ZERO;
if (ObjectUtil.isEmpty(cost)) cost=BigDecimal.ZERO;
return cost.add(cost1);
}
@Override
public BigDecimal outsourcedProcessingFee(Long id, Long projectSubId) {
BigDecimal cost=processBomMapper.outsourcedProcessingFee(id,projectSubId);
if (ObjectUtil.isEmpty(cost)) cost=BigDecimal.ZERO;
return cost;
}
@Override
public BigDecimal internalLaborCost(Long id, Long projectSubId) {
BigDecimal cost=processBomMapper.internalLaborCost(id,projectSubId);
if (ObjectUtil.isEmpty(cost)) cost=BigDecimal.ZERO;
return cost; }
private void createProcessBomDetailList(String bomCode,Long bomId, List<ProcessBomDetailDO> list,Integer num) {
LocalDateTime now = LocalDateTime.now();
/*list.forEach(o -> {o.setBomId(bomId);o.setUpdateTimes(now);}

View File

@ -0,0 +1,12 @@
<?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.chanko.yunxi.mes.module.heli.dal.mysql.masterline.MasterLineMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -22,6 +22,46 @@
select * From project_plan where id =#{param1}
</select>
<select id="StandardPartsCost" resultType="java.math.BigDecimal">
SELECT ROUND(sum(o.estimated_price*ROUND( bd.amount/ o.purchase_amount, 2)),2) cost
FROM pro_process_bom bom
left join pro_process_bom_detail bd on bd.bom_id=bom.id and bd.deleted=0 and bd.tenant_id=2
left join project_purchase_order_no_detail o on o.boom_detail_id=bd.id and o.deleted=0 and o.tenant_id=2
where bom.deleted=0 and bd.type=1 and bom.project_id=#{id} and bom.project_sub_id=#{projectSubId}
</select>
<select id="materialCost" resultType="java.math.BigDecimal">
SELECT sum(o.estimated_price) cost
from pro_task_dispatch t
left join pro_task_dispatch_detail t1 on t.id=t1.dispatch_id and t1.deleted=0 and t1.tenant_id=2
left join project_material_plan_boom p on p.id=t1.project_material_plan_detail_id and p.deleted=0 and p.tenant_id=2
left join project_purchase_order_make_detail make on make.id=p.project_purchase_order_make_detail_id and make.deleted=0 and make.tenant_id=2
left join project_purchase_order_no_detail o on o.id=make.purchase_order_no_detail_id and o.deleted=0 and o.tenant_id=2
where t1.is_outsourcing='Y' and t.deleted=0 and t.dispatch_type='PRODUCTION' and t.project_id=#{id}
</select>
<select id="outsourcedProcessingFee" resultType="java.math.BigDecimal">
SELECT sum(r.work_time) cost
from pro_task_dispatch t
left join pro_task_dispatch_detail t1 on t.id=t1.dispatch_id and t1.deleted=0 and t1.tenant_id=2
left join pro_task_report r on r.dispatch_detail_id=t1.id and r.deleted=0 and r.tenant_id=2
where t1.is_outsourcing='Y' and t.deleted=0 and t.dispatch_type='PRODUCTION' and r.work_type=2 and t.project_id=#{id}
</select>
<select id="bubbleFees" resultType="java.math.BigDecimal">
SELECT sum(make.foam_price) cost
from pro_process_bom_detail t
left join project_purchase_order_make_detail make on make.boom_detail_id=t.id and make.deleted=0 and make.tenant_id=2
where make.is_foam='Y' and t.deleted=0 and t.type=2 and make.project_plan_sub_id=#{projectSubId}
</select>
<select id="internalLaborCost" resultType="java.math.BigDecimal">
SELECT sum(COALESCE(r.work_time, 0) * p.grade_cost) cost
from pro_task_dispatch t
left join pro_task_dispatch_detail t1 on t.id=t1.dispatch_id and t1.deleted=0 and t1.tenant_id=2
left join pro_task_report r on r.dispatch_detail_id=t1.id and r.deleted=0 and r.tenant_id=2
left join system_user_post u on u.user_id=r.owner and u.deleted=0 and u.tenant_id=2
left join system_post p on p.id=u.post_id and u.deleted=0 and p.tenant_id=2 and p.status=0
where t1.is_outsourcing='N' and t.deleted=0 and t.dispatch_type='PRODUCTION' and r.work_type=1 and t.project_id=#{id}
</select>
<update id="updateDetailEditStatusById" parameterType="Long">
UPDATE pro_process_bom_detail

View File

@ -9,4 +9,12 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="StandardPartsCost" resultType="java.math.BigDecimal">
SELECT ROUND(SUM(COALESCE(mat.storage_ok_qty,0) * COALESCE(mat.price,0)), 2) cost
from wms_storage sto
left join wms_storage_mat mat on mat.stock_id=sto.id and mat.deleted=0 and mat.tenant_id=2
left join base_material m on mat.mat_id=m.id and m.deleted=0 and m.tenant_id=2
where sto.stock_in_type=5 and m.material_type=5 and sto.status=4 and sto.project_no=#{projectSubId}
</select>
</mapper>

View File

@ -41,3 +41,11 @@ export const deleteMaster = async (id: number) => {
export const exportMaster = async (params) => {
return await request.download({ url: `/heli/master/export-excel`, params })
}
// 查询借用主分页
export const getMasterLinePage = async (params) => {
return await request.get({ url: `/heli/master/getMasterLinePage`, params })
}
// 导出借用主 Excel
export const exportMasterLine = async (params) => {
return await request.download({ url: `/heli/master/exportMasterLine`, params })
}

View File

@ -0,0 +1,44 @@
import request from '@/config/axios'
export interface MasterLineVO {
id: number
jyId: number
jyMaster: string
jyNum: string
rem: string
matId: number
}
// 查询借用行分页
export const getMasterLinePage = async (params) => {
return await request.get({ url: `/heli/master-line/page`, params })
}
// 查询借用行详情
export const getMasterLine = async (id: number) => {
return await request.get({ url: `/heli/master-line/get?id=` + id })
}
// 新增借用行
export const createMasterLine = async (data: MasterLineVO) => {
return await request.post({ url: `/heli/master-line/create`, data })
}
// 修改借用行
export const updateMasterLine = async (data: MasterLineVO) => {
return await request.put({ url: `/heli/master-line/update`, data })
}
// 删除借用行
export const deleteMasterLine = async (id: number) => {
return await request.delete({ url: `/heli/master-line/delete?id=` + id })
}
// 导出借用行 Excel
export const exportMasterLine = async (params) => {
return await request.download({ url: `/heli/master-line/export-excel`, params })
}
// 查询借用行详情
export const getByMasterId = async (id: number) => {
return await request.get({ url: `/heli/master-line/getByMasterId?id=` + id })
}

View File

@ -1,29 +1,30 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible" width="1200">
<Dialog :title="dialogTitle" v-model="dialogVisible" width="1100">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="180px"
label-width="150px"
v-loading="formLoading"
>
<el-row>
<el-col :span="8">
<el-form-item label="借用人" prop="jyUser">
<el-form-item label="责任人" prop="jyUser">
<!-- <el-input v-model="formData.jyUser" placeholder="请输入借用人" />-->
<el-select v-model="formData.jyUser" placeholder="请选择借用人" filterable>
<el-select v-model="formData.jyUser" placeholder="请选择借用人" filterable clearable class="!w-240px"
>
<el-option
v-for="user in userList"
:key="user.id"
:label="user.nickname"
:label="user.username + ' ' + user.nickname"
:value="user.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="借用部门" prop="jyBm">
<el-form-item label="部门" prop="jyBm">
<!-- <el-input v-model="formData.jyBm" placeholder="请输入借用部门" />-->
<!-- <el-select v-model="formData.jyUser" placeholder="请选择借用人">-->
<!-- <el-option-->
@ -33,11 +34,11 @@
<!-- :value="user.id"-->
<!-- />-->
<!-- </el-select>-->
<BranchSelect v-model="formData.jyBm" placeholder="请选择借用部门"/>
<BranchSelect v-model="formData.jyBm" clearable placeholder="请选择部门"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="借用类型" prop="jyType">
<el-form-item label="类型" prop="jyType">
<el-select
v-model="formData.jyType"
placeholder="请选择借用类型"
@ -73,7 +74,7 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="借用日期" prop="jyDate" >
<el-form-item label="日期" prop="jyDate" >
<el-date-picker
v-model="formData.jyDate"
type="date"
@ -83,7 +84,7 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="借用物料名称" prop="jyMaster">
<!-- <el-form-item label="借用物料名称" prop="jyMaster">-->
<!-- <el-input v-model="formData.jyMaster" placeholder="请输入借用物料名称" />-->
<!-- <el-select v-model="formData.jyMaster" placeholder="请选择借用物料名称">-->
<!-- <el-option-->
@ -93,32 +94,91 @@
<!-- :value="material.id"-->
<!-- />-->
<!-- </el-select>-->
<div class="!w-265px">
<el-input v-model="formData.jyMasterName" @click.prevent="serachLog" >
<template #append><el-button
:icon="Search"
@click="serachLog" /></template>
</el-input>
</div>
</el-form-item>
<!-- <div class="!w-265px">-->
<!-- <el-input v-model="formData.jyMasterName" @click.prevent="serachLog" >-->
<!-- <template #append><el-button-->
<!-- :icon="Search"-->
<!-- @click="serachLog" /></template>-->
<!-- </el-input>-->
<!-- </div>-->
<!-- </el-form-item>-->
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="数量" prop="num">
<el-input-number v-model="formData.num" placeholder="请输入数量" />
</el-form-item>
</el-col>
<el-col :span="8">
<!-- <el-col :span="8">-->
<!-- <el-form-item label="数量" prop="num">-->
<!-- <el-input-number v-model="formData.num" placeholder="请输入数量" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<el-col :span="24">
<el-form-item label="备注" prop="rem">
<el-input v-model="formData.rem" placeholder="请输入备注" />
<el-input v-model="formData.rem" placeholder="请输入备注" type="textarea"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-card class="hl-card-info">
<template #header>
<div class="hl-card-info-icona"></div><span class="hl-card-info-text">物料明细信息</span>
</template>
<el-row>
<el-col>
<el-card class="hl-incard">
<el-col>
<el-button type="primary" size="large" @click="onAddItem" >新增</el-button>
<el-button type="success" size="large" @click="submitForm" >保存</el-button>
</el-col>
<el-form ref="OrderYsDetailSubFormRef" :model="formData.jyDetails" label-width="0" >
<el-table :data="formData.jyDetails" class="hl-table" >
<el-table-column type="index" label="序号" align="center" min-width="60" fixed />
<el-table-column label="物料名称" align="center" min-width="250" >
<template #header><span class="hl-table_header">*</span>物料名称</template>
<template #default="scope">
<el-input
v-model="scope.row.jyMaster"
disabled
style="width: 100%"
class="align-input"
>
<template #suffix>
<Icon @click="serachLog(scope.$index)" icon="ep:search" color="primary"/>
</template>
</el-input>
</template>
</el-table-column>
<el-table-column min-width="180" align="center">
<template #header><span class="hl-table_header">*</span>数量</template>
<template #default="scope">
<el-form-item prop="jyNum" style="margin-bottom: 0">
<el-input
v-model="scope.row.jyNum"
type="number"
placeholder="请输入数量"
min="0"
onkeypress="return event.charCode >= 48"
@input="handleInput(scope.row)"
style="width: 100%"
class="align-input"
/>
</el-form-item>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="120" fixed="right">
<template #default="scope">
<el-button link type="danger" size="small" @click.prevent="onDeleteItem(scope.$index)" >
删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-form>
</el-card>
</el-col>
</el-row>
</el-card>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<!-- <el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>-->
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
@ -129,13 +189,13 @@
import * as MasterApi from '@/api/heli/master'
import {DICT_TYPE, getStrDictOptions} from "@/utils/dict";
import * as UserApi from "@/api/system/user";
import * as MaterialApi from "@/api/heli/material";
import * as MasterLineApi from "@/api/heli/masterline";
import * as DeptApi from "@/api/system/dept";
import BranchSelect from "@/views/heli/hlvuestyle/branchSelect.vue";
import matLog from './storageLogs.vue'
import {ref} from "vue";
import {Search} from "@element-plus/icons-vue";
const matLogRef = ref()
const { t } = useI18n() //
const message = useMessage() //
const userList = ref<any[]>([]) //
@ -156,8 +216,14 @@ const formData = ref({
num: undefined,
jyDate:undefined,
jyMasterName:undefined,
jyDetails:[]
})
const formRules = reactive({
jyUser: [{ required: true, message: '责任人不能为空', trigger: 'change' }],
jyBm: [{ required: true, message: '部门不能为空', trigger: 'change' }],
jyType: [{ required: true, message: '类型不能为空', trigger: 'change' }],
jyDate: [{ required: true, message: '日期不能为空', trigger: 'change' }]
})
const formRef = ref() // Ref
@ -172,21 +238,61 @@ const open = async (type: string, id?: number) => {
formLoading.value = true
try {
formData.value = await MasterApi.getMaster(id)
formData.value.jyDetails= await MasterLineApi.getByMasterId(id)
} finally {
formLoading.value = false
}
}
userList.value = await UserApi.getSimpleUserList()
materialList.value = await MaterialApi.getSimpList()
// materialList.value = await MaterialApi.getSimpList()
deptList.value = await DeptApi.getSimpleDeptList()
}
defineExpose({ open }) // open
const onDeleteItem = async (index) => {
let deletedItems = formData.value.jyDetails.splice(index, 1)
let id = deletedItems[0].id;
if (id) await MasterLineApi.deleteMasterLine(id)
}
const handleInput=(row) =>{
//
if (row.jyNum < 0) {
row.jyNum = 0;
}
if (row.jyNum){
//
row.jyNum = Math.max(0, parseInt(row.jyNum) || 0);
}
}
const onAddItem = () => {
const row = {
id: undefined,
jyNum: undefined,
jyMaster: undefined,
cgId: undefined,
matId: undefined,
jyId: undefined,
}
formData.value.jyDetails.push(row)
}
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
await formRef.value.validate()
for (let i = 0; i < formData.value.jyDetails.length; i++) {
if (formData.value.jyDetails[i].jyMaster==null){
message.error('第'+(i+1)+'行物料名称不能为空')
return false
}
if (formData.value.jyDetails[i].jyNum==null){
message.error('第'+(i+1)+'行数量不能为空')
return false
}
}
//
formLoading.value = true
try {
@ -205,13 +311,15 @@ const submitForm = async () => {
formLoading.value = false
}
}
const serachLog = () => {
matLogRef.value.open()
// const serachLog = () => {
// matLogRef.value.open()
// }
const serachLog = (index) => {
matLogRef.value.open(index)
}
const getMat = async (data) => {
formData.value.jyMaster=data.id;
formData.value.jyMasterName=data.name
const getMat = async (index,id,name) => {
formData.value.jyDetails[index].jyMaster=name;
formData.value.jyDetails[index].matId=id
}
/** 重置表单 */
const resetForm = () => {
@ -223,7 +331,8 @@ const resetForm = () => {
jyMaster: undefined,
jyUser: undefined,
jyType: undefined,
num: undefined
num: undefined,
jyDetails: []
}
formRef.value?.resetFields()
}

View File

@ -8,28 +8,37 @@
:inline="true"
label-width="100px"
>
<el-form-item label="借用人" prop="jyUser">
<el-form-item label="责任人" prop="jyUser">
<el-input
v-model="queryParams.jyUser"
placeholder="请输入借用人"
placeholder="请输入责任人"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="借用部门" prop="jyBm">
<!-- <el-form-item label="负责人" prop="projectOwner">-->
<!-- <el-select class="!w-240px" v-model="queryParams.jyUser" filterable >-->
<!-- <el-option v-for="dict in userInit" :key="dict.id"-->
<!-- :label="dict.username + ' ' + dict.nickname" :value="dict.id" />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="部门" prop="jyBm">
<el-input
v-model="queryParams.jyBm"
placeholder="请输入借用部门"
placeholder="请输入部门"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
<!-- <BranchSelect v-model="queryParams.jyBm" clearable placeholder="请选择部门" @keyup.enter="handleQuery" class="!w-240px"/>-->
</el-form-item>
<el-form-item label="借用类型" prop="jyType">
<el-form-item label="类型" prop="jyType">
<el-select
v-model="queryParams.jyType"
placeholder="请选择借用类型"
placeholder="请选择类型"
clearable
class="!w-240px"
>
@ -94,24 +103,24 @@
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column fixed type="index" width="100" label="序号" align="center" />
<el-table-column label="借用人" align="center" prop="jyUsers" >
<el-table-column label="责任人" align="center" prop="jyUsers" >
<!-- <template #default="scope">-->
<!-- {{ userList.find((user) => user.id === scope.row.jyUser)?.nickname }}-->
<!-- </template>-->
</el-table-column>
<el-table-column label="借用部门" align="center" prop="jyBms" >
<el-table-column label="部门" align="center" prop="jyBms" >
<!-- <template #default="scope">-->
<!-- {{deptList.find((dept)=>dept.id==scope.row.jyBm)?.name}}-->
<!-- </template>-->
</el-table-column>
<el-table-column
label="单据日期"
label="日期"
align="center"
prop="jyDate"
:formatter="dateFormatter1"
width="180px"
/>
<el-table-column label="借用类型" align="center" prop="jyType" >
<el-table-column label="类型" align="center" prop="jyType" >
<template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_BORROW_TYPE" :value="scope.row.jyType" />
</template>
@ -121,12 +130,12 @@
<dict-tag :type="DICT_TYPE.HELI_USE" :value="scope.row.jyYt" />
</template>
</el-table-column>
<el-table-column label="数量" align="center" prop="num" />
<el-table-column label="借用物料名称" align="center" prop="jyMasters" width="180">
<!-- <el-table-column label="数量" align="center" prop="num" />-->
<!-- <el-table-column label="借用物料名称" align="center" prop="jyMasters" width="180">-->
<!-- <template #default="scope">-->
<!-- {{materialList.find((material)=>material.id==scope.row.jyMaster)?.name}}-->
<!-- </template>-->
</el-table-column>
<!-- </el-table-column>-->
<el-table-column label="备注" align="center" prop="rem" />
<el-table-column label="操作" align="center">
<template #default="scope">
@ -171,6 +180,8 @@ import {DICT_TYPE, getStrDictOptions} from "@/utils/dict";
import * as UserApi from "@/api/system/user";
import * as MaterialApi from "@/api/heli/material";
import * as DeptApi from "@/api/system/dept";
import {ref} from "vue";
import BranchSelect from "@/views/heli/hlvuestyle/branchSelect.vue";
defineOptions({ name: 'Master' })
@ -182,6 +193,7 @@ const deptList = ref<any[]>([]) // 部门列表
const loading = ref(true) //
const list = ref([]) //
const total = ref(0) //
const userInit = ref()
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
@ -258,7 +270,7 @@ const handleExport = async () => {
/** 初始化 **/
onMounted(async () => {
getList()
userList.value = await UserApi.getSimpleUserList()
userInit.value = await UserApi.getSimpleUserList()
materialList.value = await MaterialApi.getSimpList()
deptList.value = await DeptApi.getSimpleDeptList()
})

View File

@ -8,28 +8,28 @@
:inline="true"
label-width="100px"
>
<el-form-item label="借用人" prop="jyUser">
<el-form-item label="责任人" prop="jyUser">
<el-input
v-model="queryParams.jyUser"
placeholder="请输入借用人"
placeholder="请输入责任人"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="借用部门" prop="jyBm">
<el-form-item label="部门" prop="jyBm">
<el-input
v-model="queryParams.jyBm"
placeholder="请输入借用部门"
placeholder="请输入部门"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="借用类型" prop="jyType">
<el-form-item label="类型" prop="jyType">
<el-select
v-model="queryParams.jyType"
placeholder="请选择借用类型"
placeholder="请选择类型"
clearable
class="!w-240px"
>
@ -77,15 +77,15 @@
<!-- >-->
<!-- <Icon icon="ep:plus" class="mr-5px" /> 新增-->
<!-- </el-button>-->
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- @click="handleExport"-->
<!-- :loading="exportLoading"-->
<!-- v-hasPermi="['heli:master:export']"-->
<!-- >-->
<!-- <Icon icon="ep:download" class="mr-5px" /> 导出-->
<!-- </el-button>-->
<el-button
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['heli:master:export']"
>
<Icon icon="ep:download" class="mr-5px" /> 导出
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
@ -94,40 +94,40 @@
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" show-summary :summary-method="getSummaries">
<el-table-column fixed type="index" width="100" label="序号" align="center" />
<el-table-column label="借用人" align="center" prop="jyUsers" >
<el-table-column label="责任人" align="center" prop="jyUsers" width="180">
<!-- <template #default="scope">-->
<!-- {{ userList.find((user) => user.id === scope.row.jyUser)?.nickname }}-->
<!-- </template>-->
</el-table-column>
<el-table-column label="借用部门" align="center" prop="jyBms" >
<el-table-column label="部门" align="center" prop="jyBms" width="180">
<!-- <template #default="scope">-->
<!-- {{deptList.find((dept)=>dept.id==scope.row.jyBm)?.name}}-->
<!-- </template>-->
</el-table-column>
<el-table-column
label="单据日期"
label="日期"
align="center"
prop="jyDate"
:formatter="dateFormatter1"
width="180px"
/>
<el-table-column label="借用类型" align="center" prop="jyType" >
<el-table-column label="类型" align="center" prop="jyTypes" width="150" >
<template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_BORROW_TYPE" :value="scope.row.jyType" />
<dict-tag :type="DICT_TYPE.HELI_BORROW_TYPE" :value="scope.row.jyTypes" />
</template>
</el-table-column>
<el-table-column label="用途" align="center" prop="jyYt">
<el-table-column label="用途" align="center" prop="jyYt" width="150">
<template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_USE" :value="scope.row.jyYt" />
</template>
</el-table-column>
<el-table-column label="数量" align="center" prop="num" />
<el-table-column label="借出数量" align="center" prop="quantityLent" />
<el-table-column label="借用物料名称" align="center" prop="jyMasters" width="160">
<!-- <template #default="scope">-->
<!-- {{materialList.find((material)=>material.id==scope.row.jyMaster)?.name}}-->
<!-- </template>-->
<el-table-column label="物料名称" align="center" prop="jyMasters" width="250">
<!-- <template #default="scope">-->
<!-- {{materialList.find((material)=>material.id==scope.row.jyMaster)?.name}}-->
<!-- </template>-->
</el-table-column>
<el-table-column label="数量" align="center" prop="jyNum" width="100"/>
<el-table-column label="借出数量" align="center" prop="quantityLent" width="100"/>
<el-table-column label="备注" align="center" prop="rem" />
<!-- <el-table-column label="操作" align="center" width="140">-->
<!-- <template #default="scope">-->
@ -202,13 +202,13 @@ const exportLoading = ref(false) // 导出的加载中
const getList = async () => {
loading.value = true
try {
const data = await MasterApi.getMasterPage(queryParams)
const data = await MasterApi.getMasterLinePage(queryParams)
list.value = data.list
list.value.map(item=>{
if (item.jyType=="4"){
item.quantityLent= Number(-Math.abs(item.num));
}else if (item.jyType=="1"){
item.quantityLent= Number(item.num);
if (item.jyTypes=="4"){
item.quantityLent= Number(-Math.abs(item.jyNum));
}else if (item.jyTypes=="1"){
item.quantityLent= Number(item.jyNum);
}else {
item.quantityLent=0
}
@ -257,8 +257,8 @@ const handleExport = async () => {
await message.exportConfirm()
//
exportLoading.value = true
const data = await MasterApi.exportMaster(queryParams)
download.excel(data, '借用主.xls')
const data = await MasterApi.exportMasterLine(queryParams)
download.excel(data, '员工借用物料报表.xlsx')
} catch {
} finally {
exportLoading.value = false

View File

@ -4,10 +4,10 @@
<ContentWrap class="borderxx">
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="120px">
<el-form-item label="物料名称" prop="matName" >
<el-form-item label="物料名称" prop="name" >
<el-input v-model="queryParams.name" placeholder="物料名称" clearable @keyup.enter="handleQuery" class="!w-240px" />
</el-form-item>
<el-form-item label="规格型号" prop="matName" >
<el-form-item label="规格型号" prop="spec" >
<el-input v-model="queryParams.spec" placeholder="规格型号" clearable @keyup.enter="handleQuery" class="!w-240px" />
</el-form-item>
<el-form-item label="物料简称" prop="shortName" >
@ -64,10 +64,10 @@
</el-card>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="success">
<el-button type="primary" @click="success">
确认
</el-button>
<el-button @click="dialogVisible = false">取消</el-button>
</span>
</template>
</Dialog>
@ -157,7 +157,11 @@ const handleQuery = () => {
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
// queryFormRef.value.resetFields()
queryParams.name=undefined
queryParams.spec=undefined
queryParams.materialType="3"
queryParams.shortName=undefined
handleQuery()
}
@ -168,8 +172,10 @@ const open = async (rowids) => {
dialogVisible.value = true
// queryParams.matName = matCode;
rowid.value = rowids
console.log(rowids)
console.log(rowid.value)
queryParams.name=undefined
queryParams.spec=undefined
queryParams.materialType="3"
queryParams.shortName=undefined
await getList();
}
@ -178,7 +184,7 @@ const emit = defineEmits(['success'])
// emit('success', multipleSelection.value)
const success = () => {
dialogVisible.value = false;
emit('success', clickItem.value[0])
emit('success', rowid.value, clickItem.value[0].id, clickItem.value[0].name)
}

View File

@ -11,7 +11,7 @@
<UploadImg v-model="formData.logo" />
</el-form-item>
<el-form-item label="物料编码" prop="code">
<el-input disabled v-model="formData.code" placeholder="系统自动生成" class="!w-250px" />
<el-input v-model="formData.code" placeholder="请输入物料编码" class="!w-250px" />
</el-form-item>
<el-form-item label="物料名称" prop="name">
<el-input v-model="formData.name" placeholder="请输入物料名称" class="!w-250px" />
@ -152,6 +152,7 @@ const formData = ref({
})
const formRules = reactive({
name: [{ required: true, message: '物料名称不能为空', trigger: 'blur' }],
code: [{ required: true, message: '物料编码不能为空', trigger: 'blur' }],
status: [{ required: true, message: '启用状态不能为空', trigger: 'blur' }],
materialType: [{ required: true, message: '物料类型不能为空', trigger: 'change' }],
unit: [{ required: true, message: '系统单位不能为空', trigger: 'change' }],

View File

@ -29,7 +29,7 @@
<el-form-item label="客户名称" prop="customerName">
<el-input
v-model="queryParams.customerName"
placeholder="请输入生产计划号"
placeholder="请输入客户名称"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
@ -68,23 +68,17 @@
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" border class="hl-table">
<el-table-column type="index" width="70" fixed label="序号" align="center" />
<el-table-column v-if="false" label="项目ID" align="center" prop="id" width="240px" />
<el-table-column label="项目编号" align="center" prop="code" width="200px" />
<el-table-column label="项目名称" align="center" prop="projectName" width="240px"/>
<el-table-column label="客户全称" align="center" prop="customerName" width="240px"/>
<el-table-column label="子项目Id" v-if="false" align="center" prop="projectSubId" />
<el-table-column label="子项目名称" align="center" prop="projectSubName" width="200px"/>
<el-table-column label="标准件成本(元)" align="center" prop="biaoZhunJianCost" width="200px"/>
<el-table-column label="其他成本(元)" align="center" prop="qitaCost" width="200px"/>
<!-- <el-table-column label="副资材成本" align="center" prop="fuZiCaiCost" />-->
<!-- <el-table-column label="外协加工费用" align="center" prop="waiXieCost" />-->
<el-table-column label="加工工时换算成本(元)" align="center" prop="jiaGongShiCost" width="220px"/>
<el-table-column label="运费成本(元)" align="center" prop="yunFeiCost" width="200px"/>
<el-table-column label="合计成本(元)" align="center" prop="sumCost" width="200px"/>
<el-table-column label="设备型号" align="center" prop="deviceModel" width="200px"/>
<el-table-column label="标准件成本" align="center" prop="biaoZhunJianCost" width="200px"/>
<el-table-column label="材料成本" align="center" prop="cailiaoCost" width="200px"/>
<el-table-column label="外协加工费" align="center" prop="waixeiCost" width="200px"/>
<el-table-column label="内部工时费" align="center" prop="neibuCost" width="220px"/>
<el-table-column label="运费" align="center" prop="yunFeiCost" width="200px"/>
<el-table-column label="合计成本" align="center" prop="sumCost" width="200px"/>
<el-table-column fixed="right" label="操作" align="center" width="150">
<template #default="scope">
<el-row>

View File

@ -749,10 +749,13 @@ const getList = async (arrMat) => {
}
if (noList.value.length!=0){
var filter = noList.value.filter((no)=>no.materialId==row.matId);
if (filter){
if (filter&&filter.length!=0){
row.price=filter[0].unitPrice
row.storageOkQty=filter[0].purchaseAmount
}else {
row.price=''
}
}else {
row.price=''
}