|
@@ -0,0 +1,1324 @@
|
|
|
+package cn.ezhizao.project.business.controller;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
+import cn.ezhizao.common.core.text.Convert;
|
|
|
+import cn.ezhizao.common.utils.ServletUtils;
|
|
|
+import cn.ezhizao.common.utils.StringUtils;
|
|
|
+import cn.ezhizao.framework.aspectj.lang.annotation.Log;
|
|
|
+import cn.ezhizao.framework.aspectj.lang.enums.BusinessType;
|
|
|
+import cn.ezhizao.framework.web.controller.BaseController;
|
|
|
+import cn.ezhizao.framework.web.domain.AjaxResult;
|
|
|
+import cn.ezhizao.framework.web.page.PageDomain;
|
|
|
+import cn.ezhizao.framework.web.page.TableDataInfo;
|
|
|
+import cn.ezhizao.framework.web.page.TableSupport;
|
|
|
+import cn.ezhizao.project.business.domain.*;
|
|
|
+import cn.ezhizao.project.business.service.*;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import org.apache.commons.lang3.math.NumberUtils;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.PutMapping;
|
|
|
+import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import static cn.ezhizao.framework.web.page.TableSupport.PAGE_SIZE;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 客户名称Controller
|
|
|
+ *
|
|
|
+ * @author ezhizao
|
|
|
+ * @date 2025-04-09
|
|
|
+ */
|
|
|
+@Api("公司管理")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/business/productAccessoriesMaterial")
|
|
|
+public class BizProductAccessoriesMaterialController extends BaseController
|
|
|
+{
|
|
|
+ @Resource
|
|
|
+ private IBizProductService bizProductService;
|
|
|
+ @Resource
|
|
|
+ private IBizTenantService bizTenantService;
|
|
|
+ @Resource
|
|
|
+ private IBizAccessoriesService bizAccessoriesService;
|
|
|
+ @Resource
|
|
|
+ private IBizMaterialBaseService bizMaterialBaseService;
|
|
|
+ public static final String PAGE_SIZE = "pageSize";
|
|
|
+
|
|
|
+ @GetMapping("/list")
|
|
|
+ public AjaxResult list(BizProductAccessoriesMaterial bizProductAccessoriesMaterial) throws NoSuchFieldException, IllegalAccessException
|
|
|
+ {
|
|
|
+ //判断类别
|
|
|
+ if(bizProductAccessoriesMaterial.getCategory() == null){
|
|
|
+ return error("查询失败,类别不能为空");
|
|
|
+ }
|
|
|
+ if(bizProductAccessoriesMaterial.getCategory() != 1 && bizProductAccessoriesMaterial.getCategory() != 2 && bizProductAccessoriesMaterial.getCategory() != 3){
|
|
|
+ return error("查询失败,类别只能为1、2、3");
|
|
|
+ }
|
|
|
+ //判断厂别
|
|
|
+ if(bizProductAccessoriesMaterial.getTenantId() != null){
|
|
|
+ List<BizTenant> tenantList = bizTenantService.query().eq("id", bizProductAccessoriesMaterial.getTenantId()).list();
|
|
|
+ if(tenantList.isEmpty()){
|
|
|
+ return error("查询失败,租户ID不存在");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String pageSizeStr = ServletUtils.getParameter(PAGE_SIZE);
|
|
|
+ if (pageSizeStr !=null) {
|
|
|
+ startPage(); // 若依的分页方法
|
|
|
+ }
|
|
|
+ //类别为1 product
|
|
|
+ if(bizProductAccessoriesMaterial.getCategory() == 1){
|
|
|
+ BizProduct bizProduct = new BizProduct();
|
|
|
+ if(bizProductAccessoriesMaterial.getTenantId() != null){
|
|
|
+ bizProduct.setTenantId(bizProductAccessoriesMaterial.getTenantId());
|
|
|
+ }
|
|
|
+ if(bizProductAccessoriesMaterial.getProductCode() != null && bizProductAccessoriesMaterial.getProductCode() != ""){
|
|
|
+ bizProduct.setProductCode(bizProductAccessoriesMaterial.getProductCode());
|
|
|
+ }
|
|
|
+ return success(bizProductService.getList(bizProduct));
|
|
|
+ }
|
|
|
+ //类别为2 accessories
|
|
|
+ if(bizProductAccessoriesMaterial.getCategory() == 2){
|
|
|
+ BizAccessories bizAccessories = new BizAccessories();
|
|
|
+ if(bizProductAccessoriesMaterial.getTenantId() != null){
|
|
|
+ bizAccessories.setTenantId(bizProductAccessoriesMaterial.getTenantId());
|
|
|
+ }
|
|
|
+ if(bizProductAccessoriesMaterial.getAccessoriesCode() != null && bizProductAccessoriesMaterial.getAccessoriesCode() != ""){
|
|
|
+ bizAccessories.setAccessoriesCode(bizProductAccessoriesMaterial.getAccessoriesCode());
|
|
|
+ }
|
|
|
+ return success(bizAccessoriesService.getList(bizAccessories));
|
|
|
+ }
|
|
|
+ //类别为3 material
|
|
|
+ if(bizProductAccessoriesMaterial.getCategory() == 3){
|
|
|
+ BizMaterialBase bizMaterialBase = new BizMaterialBase();
|
|
|
+ if(bizProductAccessoriesMaterial.getTenantId() != null){
|
|
|
+ bizMaterialBase.setTenantId(bizProductAccessoriesMaterial.getTenantId());
|
|
|
+ }
|
|
|
+ if(bizProductAccessoriesMaterial.getMaterialCode() != null && bizProductAccessoriesMaterial.getMaterialCode() != ""){
|
|
|
+ bizMaterialBase.setMaterialCode(bizProductAccessoriesMaterial.getMaterialCode());
|
|
|
+ }
|
|
|
+ return success(bizMaterialBaseService.getList(bizMaterialBase));
|
|
|
+ }
|
|
|
+ return success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping
|
|
|
+ @Transactional
|
|
|
+ public AjaxResult add(@RequestBody List<BizProductAccessoriesMaterial> bizProductAccessoriesMaterialList) throws NoSuchFieldException, IllegalAccessException
|
|
|
+ {
|
|
|
+ //判断传入的个数
|
|
|
+ if(bizProductAccessoriesMaterialList.size() == 0){
|
|
|
+ throw new RuntimeException("新增失败,数据不能为空");
|
|
|
+ }
|
|
|
+ if(bizProductAccessoriesMaterialList.size() >100) {
|
|
|
+ Set<Integer> categorySet = bizProductAccessoriesMaterialList.stream()
|
|
|
+ .filter(Objects::nonNull) // 确保对象本身不为 null
|
|
|
+ .map(BizProductAccessoriesMaterial::getCategory)
|
|
|
+ .filter(Objects::nonNull) // 过滤掉 category 为 null 的值
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ List<Integer> categoryList = new ArrayList<>(categorySet);
|
|
|
+ if (categoryList.size() > 1) {
|
|
|
+ throw new RuntimeException("新增失败,数据过多,不允许超过100条");
|
|
|
+ } else {
|
|
|
+ if (categoryList.isEmpty()) {
|
|
|
+ throw new RuntimeException("新增失败,类别不能为空");
|
|
|
+ } else {
|
|
|
+ Integer firstCategory = categoryList.get(0);
|
|
|
+ String categoryType = firstCategory.equals(1) ? "产品" : firstCategory.equals(2) ? "辅料" : "原材料";
|
|
|
+ throw new RuntimeException("新增失败:" + categoryType + "不允许超过100条");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if (bizProductAccessoriesMaterialList.stream().anyMatch(material -> material.getCategory() == null)) {
|
|
|
+ throw new RuntimeException("新增失败,类别不能为空");
|
|
|
+ }
|
|
|
+ if (bizProductAccessoriesMaterialList.stream().anyMatch(material -> material.getCategory() != 1 && material.getCategory() != 2 && material.getCategory() != 3)) {
|
|
|
+ throw new RuntimeException("新增失败,类别只能为1、2、3");
|
|
|
+ }
|
|
|
+ //查询厂别是否存在
|
|
|
+ Set<Long> tenantSet = bizProductAccessoriesMaterialList.stream()
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .map(BizProductAccessoriesMaterial::getTenantId)
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ List<Long> tenantIdsList = new ArrayList<>(tenantSet);
|
|
|
+ if (tenantIdsList.size() > 1) {
|
|
|
+ List<BizTenant> tenantList = bizTenantService.query().in("id", tenantIdsList).list();
|
|
|
+ if(tenantList.isEmpty() || tenantList.size() != tenantIdsList.size()){
|
|
|
+ throw new RuntimeException("新增失败,厂别不存在");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //产品
|
|
|
+ List<BizProductAccessoriesMaterial> productCollect = bizProductAccessoriesMaterialList.stream().filter(item -> item.getCategory() == 1).collect(Collectors.toList());
|
|
|
+ if(!productCollect.isEmpty()){
|
|
|
+ if (productCollect.stream().anyMatch(material -> material.getProductCode() == null)) {
|
|
|
+ throw new RuntimeException("新增失败,产品编码不能为空");
|
|
|
+ }
|
|
|
+ //判断产品编码是否有重复
|
|
|
+ List<String> productCodes = productCollect.stream()
|
|
|
+ .map(BizProductAccessoriesMaterial::getProductCode)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ Set<String> uniqueProductCodes = new HashSet<>(productCodes);
|
|
|
+ if (productCodes.size() != uniqueProductCodes.size()) {
|
|
|
+ throw new RuntimeException("新增失败,产品编码不能重复");
|
|
|
+ } else {
|
|
|
+ //新增的产品编码没有重复
|
|
|
+ //判断数据库是否存在相同的产品编码
|
|
|
+ List<BizProduct> bizProductList = bizProductService.query().in("product_code", productCodes).list();
|
|
|
+ if (!bizProductList.isEmpty()){
|
|
|
+ return error("新增失败,存在重复的产品编码");
|
|
|
+ }else{
|
|
|
+ List<BizProduct> productList = new ArrayList<>();
|
|
|
+ for (BizProductAccessoriesMaterial product : productCollect) {
|
|
|
+ BizProduct bizProduct = new BizProduct();
|
|
|
+ bizProduct.setTenantId(product.getTenantId() != null ? product.getTenantId() : 0L);
|
|
|
+ bizProduct.setProductCode(product.getProductCode() != null ? product.getProductCode() : "");
|
|
|
+ bizProduct.setPreStock(product.getPreStock() != null ? product.getPreStock() : "");
|
|
|
+ bizProduct.setType(product.getType() != null ? product.getType() : "");
|
|
|
+ bizProduct.setShaftBroadCategoryId(product.getShaftBroadCategoryId() != null ? product.getShaftBroadCategoryId() : 0L);
|
|
|
+ bizProduct.setShaftBroadCategoryCode(product.getShaftBroadCategoryCode() != null ? product.getShaftBroadCategoryCode() : "");
|
|
|
+ bizProduct.setShaftCategoryId(product.getShaftCategoryId() != null ? product.getShaftCategoryId() : 0L);
|
|
|
+ bizProduct.setShaftCategoryCode(product.getShaftCategoryCode() != null ? product.getShaftCategoryCode() : "");
|
|
|
+ bizProduct.setSpecification(product.getSpecification() != null ? product.getSpecification() : "");
|
|
|
+ bizProduct.setDrawingNumber(product.getDrawingNumber() != null ? product.getDrawingNumber() : "");
|
|
|
+ bizProduct.setDescription(product.getDescription() != null ? product.getDescription() : "");
|
|
|
+ bizProduct.setProductionTenantId(product.getProductionTenantId() != null ? product.getProductionTenantId() : 0L);
|
|
|
+ bizProduct.setDiameter(product.getDiameter() != null ? product.getDiameter() : BigDecimal.ZERO);
|
|
|
+ bizProduct.setLenght(product.getLenght() != null ? product.getLenght() : BigDecimal.ZERO);
|
|
|
+ bizProduct.setThickness(product.getThickness() != null ? product.getThickness() : BigDecimal.ZERO);
|
|
|
+ bizProduct.setCompanyId(product.getCompanyId() != null ? product.getCompanyId() : 0L);
|
|
|
+ bizProduct.setCompanyCode(product.getCompanyCode() != null ? product.getCompanyCode() : "");
|
|
|
+ bizProduct.setCompanyAlias(product.getCompanyAlias() != null ? product.getCompanyAlias() : "");
|
|
|
+ bizProduct.setMaterialId(product.getMaterialId() != null ? product.getMaterialId() : 0L);
|
|
|
+ bizProduct.setMaterialCode(product.getMaterialCode() != null ? product.getMaterialCode() : "");
|
|
|
+ bizProduct.setDensity(product.getDensity() != null ? product.getDensity() : BigDecimal.ZERO);
|
|
|
+ bizProduct.setSalesmanId(product.getSalesmanId() != null ? product.getSalesmanId() : 0L);
|
|
|
+ bizProduct.setSalesmanCode(product.getSalesmanCode() != null ? product.getSalesmanCode() : "");
|
|
|
+ bizProduct.setStockKeeperId(product.getStockKeeperId() != null ? product.getStockKeeperId() : 0L);
|
|
|
+ bizProduct.setStockKeeperCode(product.getStockKeeperCode() != null ? product.getStockKeeperCode() : "");
|
|
|
+ bizProduct.setDispatcherId(product.getDispatcherId() != null ? product.getDispatcherId() : 0L);
|
|
|
+ bizProduct.setDispatcherCode(product.getDispatcherCode() != null ? product.getDispatcherCode() : "");
|
|
|
+ bizProduct.setProductStatusCode(product.getProductStatusCode() != null ? product.getProductStatusCode() : "");
|
|
|
+ bizProduct.setProductStatusId(product.getProductStatusId() != null ? product.getProductStatusId() : 0L);
|
|
|
+ bizProduct.setProductionTypeId(product.getProductionTypeId() != null ? product.getProductionTypeId() : 0L);
|
|
|
+ bizProduct.setProductionTypeCode(product.getProductionTypeCode() != null ? product.getProductionTypeCode() : "");
|
|
|
+ bizProduct.setTechnicianId(product.getTechnicianId() != null ? product.getTechnicianId() : 0L);
|
|
|
+ bizProduct.setTechnicianCode(product.getTechnicianCode() != null ? product.getTechnicianCode() : "");
|
|
|
+ bizProduct.setCreatorCode(product.getCreatorCode() != null ? product.getCreatorCode() : "");
|
|
|
+ bizProduct.setMaterialNum(product.getMaterialNum() != null ? product.getMaterialNum() : "");
|
|
|
+ productList.add(bizProduct);
|
|
|
+ }
|
|
|
+ bizProductService.saveBatch(productList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //辅料
|
|
|
+ List<BizProductAccessoriesMaterial> accessoriesCollect = bizProductAccessoriesMaterialList.stream().filter(item -> item.getCategory() == 2).collect(Collectors.toList());
|
|
|
+ if(!accessoriesCollect.isEmpty()){
|
|
|
+ if (accessoriesCollect.stream().anyMatch(material -> material.getAccessoriesCode() == null)) {
|
|
|
+ throw new RuntimeException("新增失败,辅料编码不能为空");
|
|
|
+ }
|
|
|
+ //判断辅料编码是否有重复
|
|
|
+ List<String> accessoriesCodes = accessoriesCollect.stream()
|
|
|
+ .map(BizProductAccessoriesMaterial::getAccessoriesCode)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ Set<String> uniqueAccessoriesCodes = new HashSet<>(accessoriesCodes);
|
|
|
+ if (uniqueAccessoriesCodes.size() != accessoriesCodes.size()) {
|
|
|
+ throw new RuntimeException("新增失败,辅料编码不能重复");
|
|
|
+ } else {
|
|
|
+ //新增的辅料编码没有重复
|
|
|
+ //判断数据库是否存在相同的辅料编码
|
|
|
+ List<BizAccessories> bizAccessoriesList = bizAccessoriesService.query().in("accessories_code", accessoriesCodes).list();
|
|
|
+ if (!bizAccessoriesList.isEmpty()){
|
|
|
+ throw new RuntimeException("新增失败,存在重复的辅料编码");
|
|
|
+ }else{
|
|
|
+ List<BizAccessories> accessoriesList = new ArrayList<>();
|
|
|
+ for (BizProductAccessoriesMaterial accessories : accessoriesCollect) {
|
|
|
+ BizAccessories bizAccessories = new BizAccessories();
|
|
|
+ bizAccessories.setAccessoriesCode(accessories.getAccessoriesCode() != null ? accessories.getAccessoriesCode() : "");
|
|
|
+ bizAccessories.setItype(accessories.getItype() != null ? accessories.getItype() : "");
|
|
|
+ bizAccessories.setCusven(accessories.getCusven() != null ? accessories.getCusven() : "");
|
|
|
+ bizAccessories.setDescription(accessories.getDescription() != null ? accessories.getDescription() : "");
|
|
|
+ bizAccessories.setUnit(accessories.getUnit() != null ? accessories.getUnit() : "");
|
|
|
+ bizAccessories.setCruser(accessories.getCruser() != null ? accessories.getCruser() : "");
|
|
|
+ bizAccessories.setMddate(accessories.getMddate() != null ? accessories.getMddate() : null); // 日期类型,null可能更合适
|
|
|
+ bizAccessories.setMduser(accessories.getMduser() != null ? accessories.getMduser() : "");
|
|
|
+ bizAccessories.setPouom(accessories.getPouom() != null ? accessories.getPouom() : "");
|
|
|
+ bizAccessories.setHtype(accessories.getHtype() != null ? accessories.getHtype() : "");
|
|
|
+ bizAccessories.setHtyna(accessories.getHtyna() != null ? accessories.getHtyna() : "");
|
|
|
+ bizAccessories.setWriteruser(accessories.getWriteruser() != null ? accessories.getWriteruser() : "");
|
|
|
+ bizAccessories.setMonthUseAmount(accessories.getMonthUseAmount() != null ? accessories.getMonthUseAmount() : BigDecimal.ZERO);
|
|
|
+ bizAccessories.setLtype(accessories.getLtype() != null ? accessories.getLtype() : "");
|
|
|
+ bizAccessories.setDeliveryDate(accessories.getDeliveryDate() != null ? accessories.getDeliveryDate() : 0L);
|
|
|
+ bizAccessories.setSafetyStock(accessories.getSafetyStock() != null ? accessories.getSafetyStock() : BigDecimal.ZERO);
|
|
|
+ bizAccessories.setPrice(accessories.getPrice() != null ? accessories.getPrice() : BigDecimal.ZERO);
|
|
|
+ bizAccessories.setStatus(accessories.getStatus() != null ? accessories.getStatus() : "");
|
|
|
+ bizAccessories.setCrdate(accessories.getCrdate() != null ? accessories.getCrdate() : null); // 日期类型,null可能更合适
|
|
|
+ bizAccessories.setEcoMark(accessories.getEcoMark() != null ? accessories.getEcoMark() : "");
|
|
|
+ bizAccessories.setConversionRatio(accessories.getConversionRatio() != null ? accessories.getConversionRatio() : BigDecimal.ZERO);
|
|
|
+ bizAccessories.setWritedate(accessories.getWritedate() != null ? accessories.getWritedate() : null); // 日期类型,null可能更合适
|
|
|
+ bizAccessories.setPackageStandard(accessories.getPackageStandard() != null ? accessories.getPackageStandard() : "");
|
|
|
+ bizAccessories.setYpart(accessories.getYpart() != null ? accessories.getYpart() : "");
|
|
|
+ bizAccessories.setYamt(accessories.getYamt() != null ? accessories.getYamt() : BigDecimal.ZERO);
|
|
|
+ bizAccessories.setMonthAvgPrice(accessories.getMonthAvgPrice() != null ? accessories.getMonthAvgPrice() : BigDecimal.ZERO);
|
|
|
+ bizAccessories.setFtype(accessories.getFtype() != null ? accessories.getFtype() : "");
|
|
|
+ bizAccessories.setKtype(accessories.getKtype() != null ? accessories.getKtype() : "");
|
|
|
+ bizAccessories.setKtyts(accessories.getKtyts() != null ? accessories.getKtyts() : 0L);
|
|
|
+ bizAccessories.setFacno(accessories.getFacno() != null ? accessories.getFacno() : "");
|
|
|
+ bizAccessories.setTenantId(accessories.getTenantId() != null ? accessories.getTenantId() : 0L);
|
|
|
+ accessoriesList.add(bizAccessories);
|
|
|
+ }
|
|
|
+ bizAccessoriesService.saveBatch(accessoriesList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //原材料
|
|
|
+ List<BizProductAccessoriesMaterial> materialCollect = bizProductAccessoriesMaterialList.stream().filter(item -> item.getCategory() == 3).collect(Collectors.toList());
|
|
|
+ if(!materialCollect.isEmpty()){
|
|
|
+ if (materialCollect.stream().anyMatch(material -> material.getMaterialCode() == null)) {
|
|
|
+ throw new RuntimeException("新增失败,材料编码不能为空");
|
|
|
+ }
|
|
|
+ //判断原材料编码是否有重复
|
|
|
+ List<String> materialCodes = materialCollect.stream()
|
|
|
+ .map(BizProductAccessoriesMaterial::getMaterialCode)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ Set<String> uniqueMaterialCodes = new HashSet<>(materialCodes);
|
|
|
+ if (uniqueMaterialCodes.size() != materialCodes.size()) {
|
|
|
+ throw new RuntimeException("新增失败,原材料编码不能重复");
|
|
|
+ } else {
|
|
|
+ //新增的原材料编码没有重复
|
|
|
+ //判断数据库是否存在相同的原材料编码
|
|
|
+ List<BizMaterialBase> bizMaterialList = bizMaterialBaseService.query().in("material_code", materialCodes).list();
|
|
|
+ if (!bizMaterialList.isEmpty()){
|
|
|
+ throw new RuntimeException("新增失败,存在重复的原材料编码");
|
|
|
+ }else{
|
|
|
+ List<BizMaterialBase> materialList = new ArrayList<>();
|
|
|
+ for (BizProductAccessoriesMaterial material : materialCollect) {
|
|
|
+ BizMaterialBase bizMaterialBase = new BizMaterialBase();
|
|
|
+ bizMaterialBase.setMaterialCode(material.getMaterialCode() != null ? material.getMaterialCode() : "");
|
|
|
+ bizMaterialBase.setType(material.getType() != null ? material.getType() : "");
|
|
|
+ bizMaterialBase.setMnemonicCode(material.getMnemonicCode() != null ? material.getMnemonicCode() : "");
|
|
|
+ bizMaterialBase.setItemtype(material.getItemtype() != null ? material.getItemtype() : "");
|
|
|
+ bizMaterialBase.setSteelClass(material.getSteelClass() != null ? material.getSteelClass() : "");
|
|
|
+ bizMaterialBase.setRepCode(material.getRepCode() != null ? material.getRepCode() : "");
|
|
|
+ bizMaterialBase.setBarcode(material.getBarcode() != null ? material.getBarcode() : "");
|
|
|
+ bizMaterialBase.setPrloc(material.getPrloc() != null ? material.getPrloc() : "");
|
|
|
+ bizMaterialBase.setDept(material.getDept() != null ? material.getDept() : "");
|
|
|
+ bizMaterialBase.setDescription(material.getDescription() != null ? material.getDescription() : "");
|
|
|
+ bizMaterialBase.setSpecification(material.getSpecification() != null ? material.getSpecification() : "");
|
|
|
+ bizMaterialBase.setUom(material.getUom() != null ? material.getUom() : "");
|
|
|
+ bizMaterialBase.setPounit(material.getPounit() != null ? material.getPounit() : "");
|
|
|
+ bizMaterialBase.setPofact(material.getPofact() != null ? material.getPofact() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setCounit(material.getCounit() != null ? material.getCounit() : "");
|
|
|
+ bizMaterialBase.setCofact(material.getCofact() != null ? material.getCofact() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setSounit(material.getSounit() != null ? material.getSounit() : "");
|
|
|
+ bizMaterialBase.setSofact(material.getSofact() != null ? material.getSofact() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setWunit(material.getWunit() != null ? material.getWunit() : "");
|
|
|
+ bizMaterialBase.setWeight(material.getWeight() != null ? material.getWeight() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setWeigs(material.getWeigs() != null ? material.getWeigs() : 0L);
|
|
|
+ bizMaterialBase.setVolume(material.getVolume() != null ? material.getVolume() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setRounded(material.getRounded() != null ? material.getRounded() : "");
|
|
|
+ bizMaterialBase.setDraw(material.getDraw() != null ? material.getDraw() : "");
|
|
|
+ bizMaterialBase.setMpsok(material.getMpsok() != null ? material.getMpsok() : "");
|
|
|
+ bizMaterialBase.setIsstype(material.getIsstype() != null ? material.getIsstype() : "");
|
|
|
+ bizMaterialBase.setBypass(material.getBypass() != null ? material.getBypass() : "");
|
|
|
+ bizMaterialBase.setBatchqty(material.getBatchqty() != null ? material.getBatchqty() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setYield(material.getYield() != null ? material.getYield() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setCommodity(material.getCommodity() != null ? material.getCommodity() : "");
|
|
|
+ bizMaterialBase.setPrdline(material.getPrdline() != null ? material.getPrdline() : "");
|
|
|
+ bizMaterialBase.setSalgrp(material.getSalgrp() != null ? material.getSalgrp() : "");
|
|
|
+ bizMaterialBase.setPrcgrp(material.getPrcgrp() != null ? material.getPrcgrp() : "");
|
|
|
+ bizMaterialBase.setFixmo(material.getFixmo() != null ? material.getFixmo() : "");
|
|
|
+ bizMaterialBase.setPrpart(material.getPrpart() != null ? material.getPrpart() : "");
|
|
|
+ bizMaterialBase.setAttrctl(material.getAttrctl() != null ? material.getAttrctl() : "");
|
|
|
+ bizMaterialBase.setAbc(material.getAbc() != null ? material.getAbc() : "");
|
|
|
+ bizMaterialBase.setAbcctl(material.getAbcctl() != null ? material.getAbcctl() : "");
|
|
|
+ bizMaterialBase.setLcydate(material.getLcydate() != null ? material.getLcydate() : null); // 日期类型,null可能更合适
|
|
|
+ bizMaterialBase.setPrice(material.getPrice() != null ? material.getPrice() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setStdcost(material.getStdcost() != null ? material.getStdcost() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setMaterial(material.getMaterial() != null ? material.getMaterial() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setThismaterial(material.getThismaterial() != null ? material.getThismaterial() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setPrematerial(material.getPrematerial() != null ? material.getPrematerial() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setLabor(material.getLabor() != null ? material.getLabor() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setThislabor(material.getThislabor() != null ? material.getThislabor() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setPrelabor(material.getPrelabor() != null ? material.getPrelabor() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setOverhead(material.getOverhead() != null ? material.getOverhead() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setThisoverhead(material.getThisoverhead() != null ? material.getThisoverhead() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setPreoverhead(material.getPreoverhead() != null ? material.getPreoverhead() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setVarover(material.getVarover() != null ? material.getVarover() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setMutqty2(material.getMutqty2() != null ? material.getMutqty2() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setAvgprc(material.getAvgprc() != null ? material.getAvgprc() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setStdctl(material.getStdctl() != null ? material.getStdctl() : "");
|
|
|
+ bizMaterialBase.setPurchaser(material.getPurchaser() != null ? material.getPurchaser() : "");
|
|
|
+ bizMaterialBase.setPlanner(material.getPlanner() != null ? material.getPlanner() : "");
|
|
|
+ bizMaterialBase.setVendor1(material.getVendor1() != null ? material.getVendor1() : "");
|
|
|
+ bizMaterialBase.setSafqty(material.getSafqty() != null ? material.getSafqty() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setReorder(material.getReorder() != null ? material.getReorder() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setMinqty(material.getMinqty() != null ? material.getMinqty() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setMaxqty(material.getMaxqty() != null ? material.getMaxqty() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setMutqty(material.getMutqty() != null ? material.getMutqty() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setMaxperiod(material.getMaxperiod() != null ? material.getMaxperiod() : 0);
|
|
|
+ bizMaterialBase.setMerge(material.getMerge() != null ? material.getMerge() : "");
|
|
|
+ bizMaterialBase.setLead(material.getLead() != null ? material.getLead() : 0);
|
|
|
+ bizMaterialBase.setDuration(material.getDuration() != null ? material.getDuration() : 0);
|
|
|
+ bizMaterialBase.setVarbase1(material.getVarbase1() != null ? material.getVarbase1() : 0);
|
|
|
+ bizMaterialBase.setVarbase(material.getVarbase() != null ? material.getVarbase() : 0);
|
|
|
+ bizMaterialBase.setPlanitem(material.getPlanitem() != null ? material.getPlanitem() : "");
|
|
|
+ bizMaterialBase.setPolice(material.getPolice() != null ? material.getPolice() : "");
|
|
|
+ bizMaterialBase.setLlc(material.getLlc() != null ? material.getLlc() : 0);
|
|
|
+ bizMaterialBase.setOnhand(material.getOnhand() != null ? material.getOnhand() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setOnorder(material.getOnorder() != null ? material.getOnorder() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setAllocate(material.getAllocate() != null ? material.getAllocate() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setIqcqty(material.getIqcqty() != null ? material.getIqcqty() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setPriceflag(material.getPriceflag() != null ? material.getPriceflag() : "");
|
|
|
+ bizMaterialBase.setMerchandise(material.getMerchandise() != null ? material.getMerchandise() : "");
|
|
|
+ bizMaterialBase.setLot(material.getLot() != null ? material.getLot() : "");
|
|
|
+ bizMaterialBase.setAux(material.getAux() != null ? material.getAux() : "");
|
|
|
+ bizMaterialBase.setAuxunit(material.getAuxunit() != null ? material.getAuxunit() : "");
|
|
|
+ bizMaterialBase.setAuxqty(material.getAuxqty() != null ? material.getAuxqty() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setStatus(material.getStatus() != null ? material.getStatus() : "");
|
|
|
+ bizMaterialBase.setLsttxdate(material.getLsttxdate() != null ? material.getLsttxdate() : null); // 日期类型,null可能更合适
|
|
|
+ bizMaterialBase.setSubor(material.getSubor() != null ? material.getSubor() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setThissubor(material.getThissubor() != null ? material.getThissubor() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setPresubor(material.getPresubor() != null ? material.getPresubor() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setOther(material.getOther() != null ? material.getOther() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setThisother(material.getThisother() != null ? material.getThisother() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setPreother(material.getPreother() != null ? material.getPreother() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setCreatedate(material.getCreatedate() != null ? material.getCreatedate() : null); // 日期类型,null可能更合适
|
|
|
+ bizMaterialBase.setCreateuser(material.getCreateuser() != null ? material.getCreateuser() : "");
|
|
|
+ bizMaterialBase.setModifydate(material.getModifydate() != null ? material.getModifydate() : null); // 日期类型,null可能更合适
|
|
|
+ bizMaterialBase.setModifyuser(material.getModifyuser() != null ? material.getModifyuser() : "");
|
|
|
+ bizMaterialBase.setRs(material.getRs() != null ? material.getRs() : "");
|
|
|
+ bizMaterialBase.setBkitem(material.getBkitem() != null ? material.getBkitem() : "");
|
|
|
+ bizMaterialBase.setBond(material.getBond() != null ? material.getBond() : "");
|
|
|
+ bizMaterialBase.setBissue(material.getBissue() != null ? material.getBissue() : "");
|
|
|
+ bizMaterialBase.setQclead(material.getQclead() != null ? material.getQclead() : 0);
|
|
|
+ bizMaterialBase.setTfcode(material.getTfcode() != null ? material.getTfcode() : "");
|
|
|
+ bizMaterialBase.setStdlabor(material.getStdlabor() != null ? material.getStdlabor() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setStdmachine(material.getStdmachine() != null ? material.getStdmachine() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setAccumlabor(material.getAccumlabor() != null ? material.getAccumlabor() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setAccumachine(material.getAccumachine() != null ? material.getAccumachine() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setMpsprice(material.getMpsprice() != null ? material.getMpsprice() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setMpscost(material.getMpscost() != null ? material.getMpscost() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setBigclass(material.getBigclass() != null ? material.getBigclass() : "");
|
|
|
+ bizMaterialBase.setSmlclass(material.getSmlclass() != null ? material.getSmlclass() : "");
|
|
|
+ bizMaterialBase.setPotype(material.getPotype() != null ? material.getPotype() : "");
|
|
|
+ bizMaterialBase.setCstDynamical(material.getCstDynamical() != null ? material.getCstDynamical() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setCstFactory(material.getCstFactory() != null ? material.getCstFactory() : "");
|
|
|
+ bizMaterialBase.setCstEquipment(material.getCstEquipment() != null ? material.getCstEquipment() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setCstType(material.getCstType() != null ? material.getCstType() : "");
|
|
|
+ bizMaterialBase.setCstZj(material.getCstZj() != null ? material.getCstZj() : "");
|
|
|
+ bizMaterialBase.setCstPartm(material.getCstPartm() != null ? material.getCstPartm() : "");
|
|
|
+ bizMaterialBase.setCstKamt(material.getCstKamt() != null ? material.getCstKamt() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setJsyq(material.getJsyq() != null ? material.getJsyq() : "");
|
|
|
+ bizMaterialBase.setXzcode(material.getXzcode() != null ? material.getXzcode() : "");
|
|
|
+ bizMaterialBase.setZjunprc(material.getZjunprc() != null ? material.getZjunprc() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setPurtype(material.getPurtype() != null ? material.getPurtype() : "");
|
|
|
+ bizMaterialBase.setPhcode(material.getPhcode() != null ? material.getPhcode() : "");
|
|
|
+ bizMaterialBase.setXhcode(material.getXhcode() != null ? material.getXhcode() : "");
|
|
|
+ bizMaterialBase.setAddcode(material.getAddcode() != null ? material.getAddcode() : "");
|
|
|
+ bizMaterialBase.setCdcode(material.getCdcode() != null ? material.getCdcode() : "");
|
|
|
+ bizMaterialBase.setCptype(material.getCptype() != null ? material.getCptype() : "");
|
|
|
+ bizMaterialBase.setShaft(material.getShaft() != null ? material.getShaft() : "");
|
|
|
+ bizMaterialBase.setDensity(material.getDensity() != null ? material.getDensity() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setLenght(material.getLenght() != null ? material.getLenght() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setDzj(material.getDzj() != null ? material.getDzj() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setLenghts(material.getLenghts() != null ? material.getLenghts() : "");
|
|
|
+ bizMaterialBase.setGccd(material.getGccd() != null ? material.getGccd() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setDzjs(material.getDzjs() != null ? material.getDzjs() : "");
|
|
|
+ bizMaterialBase.setOnqty(material.getOnqty() != null ? material.getOnqty() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setKhjc(material.getKhjc() != null ? material.getKhjc() : "");
|
|
|
+ bizMaterialBase.setInvdate(material.getInvdate() != null ? material.getInvdate() : null); // 日期类型,null可能更合适
|
|
|
+ bizMaterialBase.setKhpart(material.getKhpart() != null ? material.getKhpart() : "");
|
|
|
+ bizMaterialBase.setZlcd(material.getZlcd() != null ? material.getZlcd() : "");
|
|
|
+ bizMaterialBase.setJsyq1(material.getJsyq1() != null ? material.getJsyq1() : "");
|
|
|
+ bizMaterialBase.setRkbz(material.getRkbz() != null ? material.getRkbz() : "");
|
|
|
+ bizMaterialBase.setHpart(material.getHpart() != null ? material.getHpart() : "");
|
|
|
+ bizMaterialBase.setLuhao(material.getLuhao() != null ? material.getLuhao() : "");
|
|
|
+ bizMaterialBase.setFacno(material.getFacno() != null ? material.getFacno() : "");
|
|
|
+ bizMaterialBase.setOrderno(material.getOrderno() != null ? material.getOrderno() : "");
|
|
|
+ bizMaterialBase.setBzhs(material.getBzhs() != null ? material.getBzhs() : 0);
|
|
|
+ bizMaterialBase.setSpcode(material.getSpcode() != null ? material.getSpcode() : "");
|
|
|
+ bizMaterialBase.setSpname(material.getSpname() != null ? material.getSpname() : "");
|
|
|
+ bizMaterialBase.setCust(material.getCust() != null ? material.getCust() : "");
|
|
|
+ bizMaterialBase.setYzj(material.getYzj() != null ? material.getYzj() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setWriteuser(material.getWriteuser() != null ? material.getWriteuser() : "");
|
|
|
+ bizMaterialBase.setWritedate(material.getWritedate() != null ? material.getWritedate() : null); // 日期类型,null可能更合适
|
|
|
+ bizMaterialBase.setWriteruser(material.getWriteruser() != null ? material.getWriteruser() : "");
|
|
|
+ bizMaterialBase.setDtype(material.getDtype() != null ? material.getDtype() : "");
|
|
|
+ bizMaterialBase.setZjbxprc(material.getZjbxprc() != null ? material.getZjbxprc() : BigDecimal.ZERO);
|
|
|
+ bizMaterialBase.setTenantId(material.getTenantId() != null ? material.getTenantId() : 0L);
|
|
|
+ materialList.add(bizMaterialBase);
|
|
|
+ }
|
|
|
+ bizMaterialBaseService.saveBatch(materialList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return success();
|
|
|
+ }
|
|
|
+ @PutMapping
|
|
|
+ public AjaxResult edit(@RequestBody List<BizProductAccessoriesMaterial> bizProductAccessoriesMaterialList) throws NoSuchFieldException, IllegalAccessException {
|
|
|
+ //判断传入的个数
|
|
|
+ if (bizProductAccessoriesMaterialList.size() == 0) {
|
|
|
+ throw new RuntimeException("修改失败,数据不能为空");
|
|
|
+ }
|
|
|
+ if (bizProductAccessoriesMaterialList.size() > 100) {
|
|
|
+ Set<Integer> categorySet = bizProductAccessoriesMaterialList.stream()
|
|
|
+ .filter(Objects::nonNull) // 确保对象本身不为 null
|
|
|
+ .map(BizProductAccessoriesMaterial::getCategory)
|
|
|
+ .filter(Objects::nonNull) // 过滤掉 category 为 null 的值
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ List<Integer> categoryList = new ArrayList<>(categorySet);
|
|
|
+ if (categoryList.size() > 1) {
|
|
|
+ throw new RuntimeException("修改失败,数据过多,不允许超过100条");
|
|
|
+ } else {
|
|
|
+ if (categoryList.isEmpty()) {
|
|
|
+ throw new RuntimeException("修改失败,类别不能为空");
|
|
|
+ } else {
|
|
|
+ Integer firstCategory = categoryList.get(0);
|
|
|
+ String categoryType = firstCategory.equals(1) ? "产品" : firstCategory.equals(2) ? "辅料" : "原材料";
|
|
|
+ throw new RuntimeException("修改失败:" + categoryType + "不允许超过100条");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (bizProductAccessoriesMaterialList.stream().anyMatch(material -> material.getId() == null)) {
|
|
|
+ throw new RuntimeException("修改失败,id不能为空");
|
|
|
+ }
|
|
|
+ if (bizProductAccessoriesMaterialList.stream().anyMatch(material -> material.getCategory() == null)) {
|
|
|
+ throw new RuntimeException("修改失败,类别不能为空");
|
|
|
+ }
|
|
|
+ if (bizProductAccessoriesMaterialList.stream().anyMatch(material -> material.getCategory() != 1 && material.getCategory() != 2 && material.getCategory() != 3)) {
|
|
|
+ throw new RuntimeException("修改失败,类别只能为1、2、3");
|
|
|
+ }
|
|
|
+ //查询厂别是否存在
|
|
|
+ Set<Long> tenantSet = bizProductAccessoriesMaterialList.stream()
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .map(BizProductAccessoriesMaterial::getTenantId)
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ List<Long> tenantIdsList = new ArrayList<>(tenantSet);
|
|
|
+ if (tenantIdsList.size() > 1) {
|
|
|
+ List<BizTenant> tenantList = bizTenantService.query().in("id", tenantIdsList).list();
|
|
|
+ if (tenantList.isEmpty() || tenantList.size() != tenantIdsList.size()) {
|
|
|
+ throw new RuntimeException("修改失败,厂别不存在");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //产品
|
|
|
+ List<BizProductAccessoriesMaterial> productCollect = bizProductAccessoriesMaterialList.stream().filter(item -> item.getCategory() == 1).collect(Collectors.toList());
|
|
|
+ if (!productCollect.isEmpty()) {
|
|
|
+ if (productCollect.stream().anyMatch(material -> material.getProductCode() == "")) {
|
|
|
+ throw new RuntimeException("修改失败,产品编码不能为空");
|
|
|
+ }
|
|
|
+ //判断产品编码是否有重复(可能存在相同的id和编码写了多次
|
|
|
+ Map<String, List<BizProductAccessoriesMaterial>> productCodeMap = productCollect.stream()
|
|
|
+ .filter(material -> material.getProductCode() != null)
|
|
|
+ .collect(Collectors.groupingBy(BizProductAccessoriesMaterial::getProductCode));
|
|
|
+
|
|
|
+ boolean hasDuplicate = productCodeMap.values().stream()
|
|
|
+ .anyMatch(list -> list.size() > 1 &&
|
|
|
+ list.stream().map(BizProductAccessoriesMaterial::getId).distinct().count() > 1);
|
|
|
+
|
|
|
+ if (hasDuplicate) {
|
|
|
+ throw new RuntimeException("修改失败,产品编码不能重复");
|
|
|
+ } else {
|
|
|
+ //新增的产品编码没有重复
|
|
|
+ //判断数据库是否存在相同的产品编码
|
|
|
+ List<String> productCodes = productCollect.stream()
|
|
|
+ .filter(material -> material.getProductCode() != null)
|
|
|
+ .map(BizProductAccessoriesMaterial::getProductCode)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if(!productCodes.isEmpty()) {
|
|
|
+ List<BizProduct> bizProductList = bizProductService.query().in("product_code", productCodes).list();
|
|
|
+ for (BizProductAccessoriesMaterial material : productCollect) {
|
|
|
+ for (BizProduct product : bizProductList) {
|
|
|
+ if (Objects.equals(material.getProductCode(), product.getProductCode()) &&
|
|
|
+ !Objects.equals(material.getId(), product.getId())) {
|
|
|
+ // 如果找到匹配的项,则抛出错误
|
|
|
+ throw new RuntimeException("修改失败,产品编码不能重复");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<BizProduct> productList = bizProductService.query().in("id", productCollect.stream()
|
|
|
+ .map(BizProductAccessoriesMaterial::getId)
|
|
|
+ .collect(Collectors.toList())).list();
|
|
|
+ for (BizProductAccessoriesMaterial product : productCollect) {
|
|
|
+ BizProduct bizProduct = productList.stream().filter(item->item.getId().equals(product.getId())).findFirst().orElse(null);
|
|
|
+ if (bizProduct == null) {
|
|
|
+ throw new RuntimeException("修改失败,产品id不存在");
|
|
|
+ }
|
|
|
+ if (product.getTenantId() != null) {
|
|
|
+ bizProduct.setTenantId(product.getTenantId());
|
|
|
+ }
|
|
|
+ if (product.getProductCode() != null) {
|
|
|
+ bizProduct.setProductCode(product.getProductCode());
|
|
|
+ }
|
|
|
+ if (product.getPreStock() != null) {
|
|
|
+ bizProduct.setPreStock(product.getPreStock());
|
|
|
+ }
|
|
|
+ if (product.getType() != null) {
|
|
|
+ bizProduct.setType(product.getType());
|
|
|
+ }
|
|
|
+ if (product.getShaftBroadCategoryId() != null) {
|
|
|
+ bizProduct.setShaftBroadCategoryId(product.getShaftBroadCategoryId());
|
|
|
+ }
|
|
|
+ if (product.getShaftBroadCategoryCode() != null) {
|
|
|
+ bizProduct.setShaftBroadCategoryCode(product.getShaftBroadCategoryCode());
|
|
|
+ }
|
|
|
+ if (product.getShaftCategoryId() != null) {
|
|
|
+ bizProduct.setShaftCategoryId(product.getShaftCategoryId());
|
|
|
+ }
|
|
|
+ if (product.getShaftCategoryCode() != null) {
|
|
|
+ bizProduct.setShaftCategoryCode(product.getShaftCategoryCode());
|
|
|
+ }
|
|
|
+ if (product.getSpecification() != null) {
|
|
|
+ bizProduct.setSpecification(product.getSpecification());
|
|
|
+ }
|
|
|
+ if (product.getDrawingNumber() != null) {
|
|
|
+ bizProduct.setDrawingNumber(product.getDrawingNumber());
|
|
|
+ }
|
|
|
+ if (product.getDescription() != null) {
|
|
|
+ bizProduct.setDescription(product.getDescription());
|
|
|
+ }
|
|
|
+ if (product.getProductionTenantId() != null) {
|
|
|
+ bizProduct.setProductionTenantId(product.getProductionTenantId());
|
|
|
+ }
|
|
|
+ if (product.getDiameter() != null) {
|
|
|
+ bizProduct.setDiameter(product.getDiameter());
|
|
|
+ }
|
|
|
+ if (product.getLenght() != null) {
|
|
|
+ bizProduct.setLenght(product.getLenght());
|
|
|
+ }
|
|
|
+ if (product.getThickness() != null) {
|
|
|
+ bizProduct.setThickness(product.getThickness());
|
|
|
+ }
|
|
|
+ if (product.getCompanyId() != null) {
|
|
|
+ bizProduct.setCompanyId(product.getCompanyId());
|
|
|
+ }
|
|
|
+ if (product.getCompanyCode() != null) {
|
|
|
+ bizProduct.setCompanyCode(product.getCompanyCode());
|
|
|
+ }
|
|
|
+ if (product.getCompanyAlias() != null) {
|
|
|
+ bizProduct.setCompanyAlias(product.getCompanyAlias());
|
|
|
+ }
|
|
|
+ if (product.getMaterialId() != null) {
|
|
|
+ bizProduct.setMaterialId(product.getMaterialId());
|
|
|
+ }
|
|
|
+ if (product.getMaterialCode() != null) {
|
|
|
+ bizProduct.setMaterialCode(product.getMaterialCode());
|
|
|
+ }
|
|
|
+ if (product.getDensity() != null) {
|
|
|
+ bizProduct.setDensity(product.getDensity());
|
|
|
+ }
|
|
|
+ if (product.getSalesmanId() != null) {
|
|
|
+ bizProduct.setSalesmanId(product.getSalesmanId());
|
|
|
+ }
|
|
|
+ if (product.getSalesmanCode() != null) {
|
|
|
+ bizProduct.setSalesmanCode(product.getSalesmanCode());
|
|
|
+ }
|
|
|
+ if (product.getStockKeeperId() != null) {
|
|
|
+ bizProduct.setStockKeeperId(product.getStockKeeperId());
|
|
|
+ }
|
|
|
+ if (product.getStockKeeperCode() != null) {
|
|
|
+ bizProduct.setStockKeeperCode(product.getStockKeeperCode());
|
|
|
+ }
|
|
|
+ if (product.getDispatcherId() != null) {
|
|
|
+ bizProduct.setDispatcherId(product.getDispatcherId());
|
|
|
+ }
|
|
|
+ if (product.getDispatcherCode() != null) {
|
|
|
+ bizProduct.setDispatcherCode(product.getDispatcherCode());
|
|
|
+ }
|
|
|
+ if (product.getProductStatusCode() != null) {
|
|
|
+ bizProduct.setProductStatusCode(product.getProductStatusCode());
|
|
|
+ }
|
|
|
+ if (product.getProductStatusId() != null) {
|
|
|
+ bizProduct.setProductStatusId(product.getProductStatusId());
|
|
|
+ }
|
|
|
+ if (product.getProductionTypeId() != null) {
|
|
|
+ bizProduct.setProductionTypeId(product.getProductionTypeId());
|
|
|
+ }
|
|
|
+ if (product.getProductionTypeCode() != null) {
|
|
|
+ bizProduct.setProductionTypeCode(product.getProductionTypeCode());
|
|
|
+ }
|
|
|
+ if (product.getTechnicianId() != null) {
|
|
|
+ bizProduct.setTechnicianId(product.getTechnicianId());
|
|
|
+ }
|
|
|
+ if (product.getTechnicianCode() != null) {
|
|
|
+ bizProduct.setTechnicianCode(product.getTechnicianCode());
|
|
|
+ }
|
|
|
+ if (product.getCreatorCode() != null) {
|
|
|
+ bizProduct.setCreatorCode(product.getCreatorCode());
|
|
|
+ }
|
|
|
+ if (product.getMaterialNum() != null) {
|
|
|
+ bizProduct.setMaterialNum(product.getMaterialNum());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ bizProductService.updateBatchById(productList);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //辅料
|
|
|
+ List<BizProductAccessoriesMaterial> accessoriesCollect = bizProductAccessoriesMaterialList.stream().filter(item -> item.getCategory() == 2).collect(Collectors.toList());
|
|
|
+ if (!accessoriesCollect.isEmpty()) {
|
|
|
+ if (accessoriesCollect.stream().anyMatch(material -> material.getAccessoriesCode() == "")) {
|
|
|
+ throw new RuntimeException("修改失败,辅料编码不能为空");
|
|
|
+ }
|
|
|
+ //判断辅料编码是否有重复(可能存在相同的id和编码写了多次
|
|
|
+ Map<String, List<BizProductAccessoriesMaterial>> accessoriesCodeMap = accessoriesCollect.stream()
|
|
|
+ .filter(material -> material.getAccessoriesCode() != null)
|
|
|
+ .collect(Collectors.groupingBy(BizProductAccessoriesMaterial::getAccessoriesCode));
|
|
|
+
|
|
|
+ boolean hasDuplicate = accessoriesCodeMap.values().stream()
|
|
|
+ .anyMatch(list -> list.size() > 1 &&
|
|
|
+ list.stream().map(BizProductAccessoriesMaterial::getId).distinct().count() > 1);
|
|
|
+
|
|
|
+ if (hasDuplicate) {
|
|
|
+ throw new RuntimeException("修改失败,辅料编码不能重复");
|
|
|
+ } else {
|
|
|
+ //判断数据库是否存在相同的辅料编码
|
|
|
+ List<String> accessorieCodes = accessoriesCollect.stream()
|
|
|
+ .filter(material -> material.getAccessoriesCode() != null)
|
|
|
+ .map(BizProductAccessoriesMaterial::getAccessoriesCode)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if(!accessorieCodes.isEmpty()) {
|
|
|
+ List<BizAccessories> bizAccessoriesList = bizAccessoriesService.query().in("accessories_code", accessorieCodes).list();
|
|
|
+ for (BizProductAccessoriesMaterial material : accessoriesCollect) {
|
|
|
+ for (BizAccessories accessories : bizAccessoriesList) {
|
|
|
+ if (Objects.equals(material.getAccessoriesCode(), accessories.getAccessoriesCode()) &&
|
|
|
+ !Objects.equals(material.getId(), accessories.getId())) {
|
|
|
+ // 如果找到匹配的项,则抛出错误
|
|
|
+ throw new RuntimeException("修改失败,辅料编码不能重复");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<BizAccessories> accesoriesList = bizAccessoriesService.query().in("id", accessoriesCollect.stream()
|
|
|
+ .map(BizProductAccessoriesMaterial::getId)
|
|
|
+ .collect(Collectors.toList())).list();
|
|
|
+ for (BizProductAccessoriesMaterial accessories : accessoriesCollect) {
|
|
|
+ BizAccessories bizAccessories = accesoriesList.stream().filter(item->item.getId().equals(accessories.getId())).findFirst().orElse(null);
|
|
|
+ if (bizAccessories == null) {
|
|
|
+ throw new RuntimeException("修改失败,辅料id不存在");
|
|
|
+ }
|
|
|
+ if (accessories.getAccessoriesCode() != null) {
|
|
|
+ bizAccessories.setAccessoriesCode(accessories.getAccessoriesCode());
|
|
|
+ }
|
|
|
+ if (accessories.getItype() != null) {
|
|
|
+ bizAccessories.setItype(accessories.getItype());
|
|
|
+ }
|
|
|
+ if (accessories.getCusven() != null) {
|
|
|
+ bizAccessories.setCusven(accessories.getCusven());
|
|
|
+ }
|
|
|
+ if (accessories.getDescription() != null) {
|
|
|
+ bizAccessories.setDescription(accessories.getDescription());
|
|
|
+ }
|
|
|
+ if (accessories.getUnit() != null) {
|
|
|
+ bizAccessories.setUnit(accessories.getUnit());
|
|
|
+ }
|
|
|
+ if (accessories.getCruser() != null) {
|
|
|
+ bizAccessories.setCruser(accessories.getCruser());
|
|
|
+ }
|
|
|
+ if (accessories.getMddate() != null) {
|
|
|
+ bizAccessories.setMddate(accessories.getMddate());
|
|
|
+ }
|
|
|
+ if (accessories.getMduser() != null) {
|
|
|
+ bizAccessories.setMduser(accessories.getMduser());
|
|
|
+ }
|
|
|
+ if (accessories.getPouom() != null) {
|
|
|
+ bizAccessories.setPouom(accessories.getPouom());
|
|
|
+ }
|
|
|
+ if (accessories.getHtype() != null) {
|
|
|
+ bizAccessories.setHtype(accessories.getHtype());
|
|
|
+ }
|
|
|
+ if (accessories.getHtyna() != null) {
|
|
|
+ bizAccessories.setHtyna(accessories.getHtyna());
|
|
|
+ }
|
|
|
+ if (accessories.getWriteruser() != null) {
|
|
|
+ bizAccessories.setWriteruser(accessories.getWriteruser());
|
|
|
+ }
|
|
|
+ if (accessories.getMonthUseAmount() != null) {
|
|
|
+ bizAccessories.setMonthUseAmount(accessories.getMonthUseAmount());
|
|
|
+ }
|
|
|
+ if (accessories.getLtype() != null) {
|
|
|
+ bizAccessories.setLtype(accessories.getLtype());
|
|
|
+ }
|
|
|
+ if (accessories.getDeliveryDate() != null) {
|
|
|
+ bizAccessories.setDeliveryDate(accessories.getDeliveryDate());
|
|
|
+ }
|
|
|
+ if (accessories.getSafetyStock() != null) {
|
|
|
+ bizAccessories.setSafetyStock(accessories.getSafetyStock());
|
|
|
+ }
|
|
|
+ if (accessories.getPrice() != null) {
|
|
|
+ bizAccessories.setPrice(accessories.getPrice());
|
|
|
+ }
|
|
|
+ if (accessories.getStatus() != null) {
|
|
|
+ bizAccessories.setStatus(accessories.getStatus());
|
|
|
+ }
|
|
|
+ if (accessories.getCrdate() != null) {
|
|
|
+ bizAccessories.setCrdate(accessories.getCrdate());
|
|
|
+ }
|
|
|
+ if (accessories.getEcoMark() != null) {
|
|
|
+ bizAccessories.setEcoMark(accessories.getEcoMark());
|
|
|
+ }
|
|
|
+ if (accessories.getConversionRatio() != null) {
|
|
|
+ bizAccessories.setConversionRatio(accessories.getConversionRatio());
|
|
|
+ }
|
|
|
+ if (accessories.getWritedate() != null) {
|
|
|
+ bizAccessories.setWritedate(accessories.getWritedate());
|
|
|
+ }
|
|
|
+ if (accessories.getPackageStandard() != null) {
|
|
|
+ bizAccessories.setPackageStandard(accessories.getPackageStandard());
|
|
|
+ }
|
|
|
+ if (accessories.getYpart() != null) {
|
|
|
+ bizAccessories.setYpart(accessories.getYpart());
|
|
|
+ }
|
|
|
+ if (accessories.getYamt() != null) {
|
|
|
+ bizAccessories.setYamt(accessories.getYamt());
|
|
|
+ }
|
|
|
+ if (accessories.getMonthAvgPrice() != null) {
|
|
|
+ bizAccessories.setMonthAvgPrice(accessories.getMonthAvgPrice());
|
|
|
+ }
|
|
|
+ if (accessories.getFtype() != null) {
|
|
|
+ bizAccessories.setFtype(accessories.getFtype());
|
|
|
+ }
|
|
|
+ if (accessories.getKtype() != null) {
|
|
|
+ bizAccessories.setKtype(accessories.getKtype());
|
|
|
+ }
|
|
|
+ if (accessories.getKtyts() != null) {
|
|
|
+ bizAccessories.setKtyts(accessories.getKtyts());
|
|
|
+ }
|
|
|
+ if (accessories.getFacno() != null) {
|
|
|
+ bizAccessories.setFacno(accessories.getFacno());
|
|
|
+ }
|
|
|
+ if (accessories.getTenantId() != null) {
|
|
|
+ bizAccessories.setTenantId(accessories.getTenantId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ bizAccessoriesService.updateBatchById(accesoriesList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //原材料
|
|
|
+ List<BizProductAccessoriesMaterial> materialCollect = bizProductAccessoriesMaterialList.stream().filter(item -> item.getCategory() == 3).collect(Collectors.toList());
|
|
|
+ if (!materialCollect.isEmpty()) {
|
|
|
+ if (materialCollect.stream().anyMatch(material -> material.getMaterialCode() == "")) {
|
|
|
+ throw new RuntimeException("修改失败,原材料编码不能为空");
|
|
|
+ }
|
|
|
+ //判断原材料编码是否有重复(可能存在相同的id和编码写了多次
|
|
|
+ Map<String, List<BizProductAccessoriesMaterial>> materialCodeMap = materialCollect.stream()
|
|
|
+ .filter(material -> material.getMaterialCode() != null)
|
|
|
+ .collect(Collectors.groupingBy(BizProductAccessoriesMaterial::getMaterialCode));
|
|
|
+
|
|
|
+ boolean hasDuplicate = materialCodeMap.values().stream()
|
|
|
+ .anyMatch(list -> list.size() > 1 &&
|
|
|
+ list.stream().map(BizProductAccessoriesMaterial::getId).distinct().count() > 1);
|
|
|
+
|
|
|
+ if (hasDuplicate) {
|
|
|
+ throw new RuntimeException("修改失败,原材料编码不能重复");
|
|
|
+ } else {
|
|
|
+ //判断数据库是否存在相同的辅料编码
|
|
|
+ List<String> materialCodes = materialCollect.stream()
|
|
|
+ .filter(material -> material.getMaterialCode() != null)
|
|
|
+ .map(BizProductAccessoriesMaterial::getMaterialCode)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (!materialCodes.isEmpty()) {
|
|
|
+ List<BizMaterialBase> bizMaterialList = bizMaterialBaseService.query().in("material_code", materialCodes).list();
|
|
|
+ for (BizProductAccessoriesMaterial material : materialCollect) {
|
|
|
+ for (BizMaterialBase materials : bizMaterialList) {
|
|
|
+ if (Objects.equals(material.getMaterialCode(), materials.getMaterial()) &&
|
|
|
+ !Objects.equals(material.getId(), materials.getId())) {
|
|
|
+ // 如果找到匹配的项,则抛出错误
|
|
|
+ throw new RuntimeException("修改失败,原材料编码不能重复");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<BizMaterialBase> materialList = bizMaterialBaseService.query().in("id", materialCollect.stream()
|
|
|
+ .map(BizProductAccessoriesMaterial::getId)
|
|
|
+ .collect(Collectors.toList())).list();
|
|
|
+ for (BizProductAccessoriesMaterial material : materialCollect) {
|
|
|
+ BizMaterialBase bizMaterialBase = materialList.stream().filter(item->item.getId().equals(material.getId())).findFirst().orElse(null);
|
|
|
+ if (bizMaterialBase == null) {
|
|
|
+ throw new RuntimeException("修改失败,原材料id不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (material.getMaterialCode() != null) {
|
|
|
+ bizMaterialBase.setMaterialCode(material.getMaterialCode());
|
|
|
+ }
|
|
|
+ if (material.getType() != null) {
|
|
|
+ bizMaterialBase.setType(material.getType());
|
|
|
+ }
|
|
|
+ if (material.getMnemonicCode() != null) {
|
|
|
+ bizMaterialBase.setMnemonicCode(material.getMnemonicCode());
|
|
|
+ }
|
|
|
+ if (material.getItemtype() != null) {
|
|
|
+ bizMaterialBase.setItemtype(material.getItemtype());
|
|
|
+ }
|
|
|
+ if (material.getSteelClass() != null) {
|
|
|
+ bizMaterialBase.setSteelClass(material.getSteelClass());
|
|
|
+ }
|
|
|
+ if (material.getRepCode() != null) {
|
|
|
+ bizMaterialBase.setRepCode(material.getRepCode());
|
|
|
+ }
|
|
|
+ if (material.getBarcode() != null) {
|
|
|
+ bizMaterialBase.setBarcode(material.getBarcode());
|
|
|
+ }
|
|
|
+ if (material.getPrloc() != null) {
|
|
|
+ bizMaterialBase.setPrloc(material.getPrloc());
|
|
|
+ }
|
|
|
+ if (material.getDept() != null) {
|
|
|
+ bizMaterialBase.setDept(material.getDept());
|
|
|
+ }
|
|
|
+ if (material.getDescription() != null) {
|
|
|
+ bizMaterialBase.setDescription(material.getDescription());
|
|
|
+ }
|
|
|
+ if (material.getSpecification() != null) {
|
|
|
+ bizMaterialBase.setSpecification(material.getSpecification());
|
|
|
+ }
|
|
|
+ if (material.getUom() != null) {
|
|
|
+ bizMaterialBase.setUom(material.getUom());
|
|
|
+ }
|
|
|
+ if (material.getPounit() != null) {
|
|
|
+ bizMaterialBase.setPounit(material.getPounit());
|
|
|
+ }
|
|
|
+ if (material.getPofact() != null) {
|
|
|
+ bizMaterialBase.setPofact(material.getPofact());
|
|
|
+ }
|
|
|
+ if (material.getCounit() != null) {
|
|
|
+ bizMaterialBase.setCounit(material.getCounit());
|
|
|
+ }
|
|
|
+ if (material.getCofact() != null) {
|
|
|
+ bizMaterialBase.setCofact(material.getCofact());
|
|
|
+ }
|
|
|
+ if (material.getSounit() != null) {
|
|
|
+ bizMaterialBase.setSounit(material.getSounit());
|
|
|
+ }
|
|
|
+ if (material.getSofact() != null) {
|
|
|
+ bizMaterialBase.setSofact(material.getSofact());
|
|
|
+ }
|
|
|
+ if (material.getWunit() != null) {
|
|
|
+ bizMaterialBase.setWunit(material.getWunit());
|
|
|
+ }
|
|
|
+ if (material.getWeight() != null) {
|
|
|
+ bizMaterialBase.setWeight(material.getWeight());
|
|
|
+ }
|
|
|
+ if (material.getWeigs() != null) {
|
|
|
+ bizMaterialBase.setWeigs(material.getWeigs());
|
|
|
+ }
|
|
|
+ if (material.getVolume() != null) {
|
|
|
+ bizMaterialBase.setVolume(material.getVolume());
|
|
|
+ }
|
|
|
+ if (material.getRounded() != null) {
|
|
|
+ bizMaterialBase.setRounded(material.getRounded());
|
|
|
+ }
|
|
|
+ if (material.getDraw() != null) {
|
|
|
+ bizMaterialBase.setDraw(material.getDraw());
|
|
|
+ }
|
|
|
+ if (material.getMpsok() != null) {
|
|
|
+ bizMaterialBase.setMpsok(material.getMpsok());
|
|
|
+ }
|
|
|
+ if (material.getIsstype() != null) {
|
|
|
+ bizMaterialBase.setIsstype(material.getIsstype());
|
|
|
+ }
|
|
|
+ if (material.getBypass() != null) {
|
|
|
+ bizMaterialBase.setBypass(material.getBypass());
|
|
|
+ }
|
|
|
+ if (material.getBatchqty() != null) {
|
|
|
+ bizMaterialBase.setBatchqty(material.getBatchqty());
|
|
|
+ }
|
|
|
+ if (material.getYield() != null) {
|
|
|
+ bizMaterialBase.setYield(material.getYield());
|
|
|
+ }
|
|
|
+ if (material.getCommodity() != null) {
|
|
|
+ bizMaterialBase.setCommodity(material.getCommodity());
|
|
|
+ }
|
|
|
+ if (material.getPrdline() != null) {
|
|
|
+ bizMaterialBase.setPrdline(material.getPrdline());
|
|
|
+ }
|
|
|
+ if (material.getSalgrp() != null) {
|
|
|
+ bizMaterialBase.setSalgrp(material.getSalgrp());
|
|
|
+ }
|
|
|
+ if (material.getPrcgrp() != null) {
|
|
|
+ bizMaterialBase.setPrcgrp(material.getPrcgrp());
|
|
|
+ }
|
|
|
+ if (material.getFixmo() != null) {
|
|
|
+ bizMaterialBase.setFixmo(material.getFixmo());
|
|
|
+ }
|
|
|
+ if (material.getPrpart() != null) {
|
|
|
+ bizMaterialBase.setPrpart(material.getPrpart());
|
|
|
+ }
|
|
|
+ if (material.getAttrctl() != null) {
|
|
|
+ bizMaterialBase.setAttrctl(material.getAttrctl());
|
|
|
+ }
|
|
|
+ if (material.getAbc() != null) {
|
|
|
+ bizMaterialBase.setAbc(material.getAbc());
|
|
|
+ }
|
|
|
+ if (material.getAbcctl() != null) {
|
|
|
+ bizMaterialBase.setAbcctl(material.getAbcctl());
|
|
|
+ }
|
|
|
+ if (material.getLcydate() != null) {
|
|
|
+ bizMaterialBase.setLcydate(material.getLcydate());
|
|
|
+ }
|
|
|
+ if (material.getPrice() != null) {
|
|
|
+ bizMaterialBase.setPrice(material.getPrice());
|
|
|
+ }
|
|
|
+ if (material.getStdcost() != null) {
|
|
|
+ bizMaterialBase.setStdcost(material.getStdcost());
|
|
|
+ }
|
|
|
+ if (material.getMaterial() != null) {
|
|
|
+ bizMaterialBase.setMaterial(material.getMaterial());
|
|
|
+ }
|
|
|
+ if (material.getThismaterial() != null) {
|
|
|
+ bizMaterialBase.setThismaterial(material.getThismaterial());
|
|
|
+ }
|
|
|
+ if (material.getPrematerial() != null) {
|
|
|
+ bizMaterialBase.setPrematerial(material.getPrematerial());
|
|
|
+ }
|
|
|
+ if (material.getLabor() != null) {
|
|
|
+ bizMaterialBase.setLabor(material.getLabor());
|
|
|
+ }
|
|
|
+ if (material.getThislabor() != null) {
|
|
|
+ bizMaterialBase.setThislabor(material.getThislabor());
|
|
|
+ }
|
|
|
+ if (material.getPrelabor() != null) {
|
|
|
+ bizMaterialBase.setPrelabor(material.getPrelabor());
|
|
|
+ }
|
|
|
+ if (material.getOverhead() != null) {
|
|
|
+ bizMaterialBase.setOverhead(material.getOverhead());
|
|
|
+ }
|
|
|
+ if (material.getThisoverhead() != null) {
|
|
|
+ bizMaterialBase.setThisoverhead(material.getThisoverhead());
|
|
|
+ }
|
|
|
+ if (material.getPreoverhead() != null) {
|
|
|
+ bizMaterialBase.setPreoverhead(material.getPreoverhead());
|
|
|
+ }
|
|
|
+ if (material.getVarover() != null) {
|
|
|
+ bizMaterialBase.setVarover(material.getVarover());
|
|
|
+ }
|
|
|
+ if (material.getMutqty2() != null) {
|
|
|
+ bizMaterialBase.setMutqty2(material.getMutqty2());
|
|
|
+ }
|
|
|
+ if (material.getAvgprc() != null) {
|
|
|
+ bizMaterialBase.setAvgprc(material.getAvgprc());
|
|
|
+ }
|
|
|
+ if (material.getStdctl() != null) {
|
|
|
+ bizMaterialBase.setStdctl(material.getStdctl());
|
|
|
+ }
|
|
|
+ if (material.getPurchaser() != null) {
|
|
|
+ bizMaterialBase.setPurchaser(material.getPurchaser());
|
|
|
+ }
|
|
|
+ if (material.getPlanner() != null) {
|
|
|
+ bizMaterialBase.setPlanner(material.getPlanner());
|
|
|
+ }
|
|
|
+ if (material.getVendor1() != null) {
|
|
|
+ bizMaterialBase.setVendor1(material.getVendor1());
|
|
|
+ }
|
|
|
+ if (material.getSafqty() != null) {
|
|
|
+ bizMaterialBase.setSafqty(material.getSafqty());
|
|
|
+ }
|
|
|
+ if (material.getReorder() != null) {
|
|
|
+ bizMaterialBase.setReorder(material.getReorder());
|
|
|
+ }
|
|
|
+ if (material.getMinqty() != null) {
|
|
|
+ bizMaterialBase.setMinqty(material.getMinqty());
|
|
|
+ }
|
|
|
+ if (material.getMaxqty() != null) {
|
|
|
+ bizMaterialBase.setMaxqty(material.getMaxqty());
|
|
|
+ }
|
|
|
+ if (material.getMutqty() != null) {
|
|
|
+ bizMaterialBase.setMutqty(material.getMutqty());
|
|
|
+ }
|
|
|
+ if (material.getMaxperiod() != null) {
|
|
|
+ bizMaterialBase.setMaxperiod(material.getMaxperiod());
|
|
|
+ }
|
|
|
+ if (material.getMerge() != null) {
|
|
|
+ bizMaterialBase.setMerge(material.getMerge());
|
|
|
+ }
|
|
|
+ if (material.getLead() != null) {
|
|
|
+ bizMaterialBase.setLead(material.getLead());
|
|
|
+ }
|
|
|
+ if (material.getDuration() != null) {
|
|
|
+ bizMaterialBase.setDuration(material.getDuration());
|
|
|
+ }
|
|
|
+ if (material.getVarbase1() != null) {
|
|
|
+ bizMaterialBase.setVarbase1(material.getVarbase1());
|
|
|
+ }
|
|
|
+ if (material.getVarbase() != null) {
|
|
|
+ bizMaterialBase.setVarbase(material.getVarbase());
|
|
|
+ }
|
|
|
+ if (material.getPlanitem() != null) {
|
|
|
+ bizMaterialBase.setPlanitem(material.getPlanitem());
|
|
|
+ }
|
|
|
+ if (material.getPolice() != null) {
|
|
|
+ bizMaterialBase.setPolice(material.getPolice());
|
|
|
+ }
|
|
|
+ if (material.getLlc() != null) {
|
|
|
+ bizMaterialBase.setLlc(material.getLlc());
|
|
|
+ }
|
|
|
+ if (material.getOnhand() != null) {
|
|
|
+ bizMaterialBase.setOnhand(material.getOnhand());
|
|
|
+ }
|
|
|
+ if (material.getOnorder() != null) {
|
|
|
+ bizMaterialBase.setOnorder(material.getOnorder());
|
|
|
+ }
|
|
|
+ if (material.getAllocate() != null) {
|
|
|
+ bizMaterialBase.setAllocate(material.getAllocate());
|
|
|
+ }
|
|
|
+ if (material.getIqcqty() != null) {
|
|
|
+ bizMaterialBase.setIqcqty(material.getIqcqty());
|
|
|
+ }
|
|
|
+ if (material.getPriceflag() != null) {
|
|
|
+ bizMaterialBase.setPriceflag(material.getPriceflag());
|
|
|
+ }
|
|
|
+ if (material.getMerchandise() != null) {
|
|
|
+ bizMaterialBase.setMerchandise(material.getMerchandise());
|
|
|
+ }
|
|
|
+ if (material.getLot() != null) {
|
|
|
+ bizMaterialBase.setLot(material.getLot());
|
|
|
+ }
|
|
|
+ if (material.getAux() != null) {
|
|
|
+ bizMaterialBase.setAux(material.getAux());
|
|
|
+ }
|
|
|
+ if (material.getAuxunit() != null) {
|
|
|
+ bizMaterialBase.setAuxunit(material.getAuxunit());
|
|
|
+ }
|
|
|
+ if (material.getAuxqty() != null) {
|
|
|
+ bizMaterialBase.setAuxqty(material.getAuxqty());
|
|
|
+ }
|
|
|
+ if (material.getStatus() != null) {
|
|
|
+ bizMaterialBase.setStatus(material.getStatus());
|
|
|
+ }
|
|
|
+ if (material.getLsttxdate() != null) {
|
|
|
+ bizMaterialBase.setLsttxdate(material.getLsttxdate());
|
|
|
+ }
|
|
|
+ if (material.getSubor() != null) {
|
|
|
+ bizMaterialBase.setSubor(material.getSubor());
|
|
|
+ }
|
|
|
+ if (material.getThissubor() != null) {
|
|
|
+ bizMaterialBase.setThissubor(material.getThissubor());
|
|
|
+ }
|
|
|
+ if (material.getPresubor() != null) {
|
|
|
+ bizMaterialBase.setPresubor(material.getPresubor());
|
|
|
+ }
|
|
|
+ if (material.getOther() != null) {
|
|
|
+ bizMaterialBase.setOther(material.getOther());
|
|
|
+ }
|
|
|
+ if (material.getThisother() != null) {
|
|
|
+ bizMaterialBase.setThisother(material.getThisother());
|
|
|
+ }
|
|
|
+ if (material.getPreother() != null) {
|
|
|
+ bizMaterialBase.setPreother(material.getPreother());
|
|
|
+ }
|
|
|
+ if (material.getCreatedate() != null) {
|
|
|
+ bizMaterialBase.setCreatedate(material.getCreatedate());
|
|
|
+ }
|
|
|
+ if (material.getCreateuser() != null) {
|
|
|
+ bizMaterialBase.setCreateuser(material.getCreateuser());
|
|
|
+ }
|
|
|
+ if (material.getModifydate() != null) {
|
|
|
+ bizMaterialBase.setModifydate(material.getModifydate());
|
|
|
+ }
|
|
|
+ if (material.getModifyuser() != null) {
|
|
|
+ bizMaterialBase.setModifyuser(material.getModifyuser());
|
|
|
+ }
|
|
|
+ if (material.getRs() != null) {
|
|
|
+ bizMaterialBase.setRs(material.getRs());
|
|
|
+ }
|
|
|
+ if (material.getBkitem() != null) {
|
|
|
+ bizMaterialBase.setBkitem(material.getBkitem());
|
|
|
+ }
|
|
|
+ if (material.getBond() != null) {
|
|
|
+ bizMaterialBase.setBond(material.getBond());
|
|
|
+ }
|
|
|
+ if (material.getBissue() != null) {
|
|
|
+ bizMaterialBase.setBissue(material.getBissue());
|
|
|
+ }
|
|
|
+ if (material.getQclead() != null) {
|
|
|
+ bizMaterialBase.setQclead(material.getQclead());
|
|
|
+ }
|
|
|
+ if (material.getTfcode() != null) {
|
|
|
+ bizMaterialBase.setTfcode(material.getTfcode());
|
|
|
+ }
|
|
|
+ if (material.getStdlabor() != null) {
|
|
|
+ bizMaterialBase.setStdlabor(material.getStdlabor());
|
|
|
+ }
|
|
|
+ if (material.getStdmachine() != null) {
|
|
|
+ bizMaterialBase.setStdmachine(material.getStdmachine());
|
|
|
+ }
|
|
|
+ if (material.getAccumlabor() != null) {
|
|
|
+ bizMaterialBase.setAccumlabor(material.getAccumlabor());
|
|
|
+ }
|
|
|
+ if (material.getAccumachine() != null) {
|
|
|
+ bizMaterialBase.setAccumachine(material.getAccumachine());
|
|
|
+ }
|
|
|
+ if (material.getMpsprice() != null) {
|
|
|
+ bizMaterialBase.setMpsprice(material.getMpsprice());
|
|
|
+ }
|
|
|
+ if (material.getMpscost() != null) {
|
|
|
+ bizMaterialBase.setMpscost(material.getMpscost());
|
|
|
+ }
|
|
|
+ if (material.getBigclass() != null) {
|
|
|
+ bizMaterialBase.setBigclass(material.getBigclass());
|
|
|
+ }
|
|
|
+ if (material.getSmlclass() != null) {
|
|
|
+ bizMaterialBase.setSmlclass(material.getSmlclass());
|
|
|
+ }
|
|
|
+ if (material.getPotype() != null) {
|
|
|
+ bizMaterialBase.setPotype(material.getPotype());
|
|
|
+ }
|
|
|
+ if (material.getCstDynamical() != null) {
|
|
|
+ bizMaterialBase.setCstDynamical(material.getCstDynamical());
|
|
|
+ }
|
|
|
+ if (material.getCstFactory() != null) {
|
|
|
+ bizMaterialBase.setCstFactory(material.getCstFactory());
|
|
|
+ }
|
|
|
+ if (material.getCstEquipment() != null) {
|
|
|
+ bizMaterialBase.setCstEquipment(material.getCstEquipment());
|
|
|
+ }
|
|
|
+ if (material.getCstType() != null) {
|
|
|
+ bizMaterialBase.setCstType(material.getCstType());
|
|
|
+ }
|
|
|
+ if (material.getCstZj() != null) {
|
|
|
+ bizMaterialBase.setCstZj(material.getCstZj());
|
|
|
+ }
|
|
|
+ if (material.getCstPartm() != null) {
|
|
|
+ bizMaterialBase.setCstPartm(material.getCstPartm());
|
|
|
+ }
|
|
|
+ if (material.getCstKamt() != null) {
|
|
|
+ bizMaterialBase.setCstKamt(material.getCstKamt());
|
|
|
+ }
|
|
|
+ if (material.getJsyq() != null) {
|
|
|
+ bizMaterialBase.setJsyq(material.getJsyq());
|
|
|
+ }
|
|
|
+ if (material.getXzcode() != null) {
|
|
|
+ bizMaterialBase.setXzcode(material.getXzcode());
|
|
|
+ }
|
|
|
+ if (material.getZjunprc() != null) {
|
|
|
+ bizMaterialBase.setZjunprc(material.getZjunprc());
|
|
|
+ }
|
|
|
+ if (material.getPurtype() != null) {
|
|
|
+ bizMaterialBase.setPurtype(material.getPurtype());
|
|
|
+ }
|
|
|
+ if (material.getPhcode() != null) {
|
|
|
+ bizMaterialBase.setPhcode(material.getPhcode());
|
|
|
+ }
|
|
|
+ if (material.getXhcode() != null) {
|
|
|
+ bizMaterialBase.setXhcode(material.getXhcode());
|
|
|
+ }
|
|
|
+ if (material.getAddcode() != null) {
|
|
|
+ bizMaterialBase.setAddcode(material.getAddcode());
|
|
|
+ }
|
|
|
+ if (material.getCdcode() != null) {
|
|
|
+ bizMaterialBase.setCdcode(material.getCdcode());
|
|
|
+ }
|
|
|
+ if (material.getCptype() != null) {
|
|
|
+ bizMaterialBase.setCptype(material.getCptype());
|
|
|
+ }
|
|
|
+ if (material.getShaft() != null) {
|
|
|
+ bizMaterialBase.setShaft(material.getShaft());
|
|
|
+ }
|
|
|
+ if (material.getDensity() != null) {
|
|
|
+ bizMaterialBase.setDensity(material.getDensity());
|
|
|
+ }
|
|
|
+ if (material.getLenght() != null) {
|
|
|
+ bizMaterialBase.setLenght(material.getLenght());
|
|
|
+ }
|
|
|
+ if (material.getDzj() != null) {
|
|
|
+ bizMaterialBase.setDzj(material.getDzj());
|
|
|
+ }
|
|
|
+ if (material.getLenghts() != null) {
|
|
|
+ bizMaterialBase.setLenghts(material.getLenghts());
|
|
|
+ }
|
|
|
+ if (material.getGccd() != null) {
|
|
|
+ bizMaterialBase.setGccd(material.getGccd());
|
|
|
+ }
|
|
|
+ if (material.getDzjs() != null) {
|
|
|
+ bizMaterialBase.setDzjs(material.getDzjs());
|
|
|
+ }
|
|
|
+ if (material.getOnqty() != null) {
|
|
|
+ bizMaterialBase.setOnqty(material.getOnqty());
|
|
|
+ }
|
|
|
+ if (material.getKhjc() != null) {
|
|
|
+ bizMaterialBase.setKhjc(material.getKhjc());
|
|
|
+ }
|
|
|
+ if (material.getInvdate() != null) {
|
|
|
+ bizMaterialBase.setInvdate(material.getInvdate());
|
|
|
+ }
|
|
|
+ if (material.getKhpart() != null) {
|
|
|
+ bizMaterialBase.setKhpart(material.getKhpart());
|
|
|
+ }
|
|
|
+ if (material.getZlcd() != null) {
|
|
|
+ bizMaterialBase.setZlcd(material.getZlcd());
|
|
|
+ }
|
|
|
+ if (material.getJsyq1() != null) {
|
|
|
+ bizMaterialBase.setJsyq1(material.getJsyq1());
|
|
|
+ }
|
|
|
+ if (material.getRkbz() != null) {
|
|
|
+ bizMaterialBase.setRkbz(material.getRkbz());
|
|
|
+ }
|
|
|
+ if (material.getHpart() != null) {
|
|
|
+ bizMaterialBase.setHpart(material.getHpart());
|
|
|
+ }
|
|
|
+ if (material.getLuhao() != null) {
|
|
|
+ bizMaterialBase.setLuhao(material.getLuhao());
|
|
|
+ }
|
|
|
+ if (material.getFacno() != null) {
|
|
|
+ bizMaterialBase.setFacno(material.getFacno());
|
|
|
+ }
|
|
|
+ if (material.getOrderno() != null) {
|
|
|
+ bizMaterialBase.setOrderno(material.getOrderno());
|
|
|
+ }
|
|
|
+ if (material.getBzhs() != null) {
|
|
|
+ bizMaterialBase.setBzhs(material.getBzhs());
|
|
|
+ }
|
|
|
+ if (material.getSpcode() != null) {
|
|
|
+ bizMaterialBase.setSpcode(material.getSpcode());
|
|
|
+ }
|
|
|
+ if (material.getSpname() != null) {
|
|
|
+ bizMaterialBase.setSpname(material.getSpname());
|
|
|
+ }
|
|
|
+ if (material.getCust() != null) {
|
|
|
+ bizMaterialBase.setCust(material.getCust());
|
|
|
+ }
|
|
|
+ if (material.getYzj() != null) {
|
|
|
+ bizMaterialBase.setYzj(material.getYzj());
|
|
|
+ }
|
|
|
+ if (material.getWriteuser() != null) {
|
|
|
+ bizMaterialBase.setWriteuser(material.getWriteuser());
|
|
|
+ }
|
|
|
+ if (material.getWritedate() != null) {
|
|
|
+ bizMaterialBase.setWritedate(material.getWritedate());
|
|
|
+ }
|
|
|
+ if (material.getWriteruser() != null) {
|
|
|
+ bizMaterialBase.setWriteruser(material.getWriteruser());
|
|
|
+ }
|
|
|
+ if (material.getDtype() != null) {
|
|
|
+ bizMaterialBase.setDtype(material.getDtype());
|
|
|
+ }
|
|
|
+ if (material.getZjbxprc() != null) {
|
|
|
+ bizMaterialBase.setZjbxprc(material.getZjbxprc());
|
|
|
+ }
|
|
|
+ if (material.getTenantId() != null) {
|
|
|
+ bizMaterialBase.setTenantId(material.getTenantId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ bizMaterialBaseService.updateBatchById(materialList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return success();
|
|
|
+ }
|
|
|
+
|
|
|
+}
|