Explorar el Código

子表按加工单拆分

wanfa99 hace 2 años
padre
commit
d55edfda2a

+ 8 - 35
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/controller/SyCostAllocationController.java

@@ -82,7 +82,6 @@ public class SyCostAllocationController {
         IPage<SyCostAllocation> pageList = syCostAllocationService.page(page, queryWrapper);
         return Result.OK(pageList);
     }
-
     /**
      * 通过计划号-销售订单号查询
      *
@@ -92,44 +91,18 @@ public class SyCostAllocationController {
     @AutoLog(value = "成本分配-通过计划号-销售订单号查询")
     @ApiOperation(value = "成本分配-通过计划号-销售订单号查询", notes = "成本分配-通过计划号-销售订单号查询")
     @GetMapping(value = "/queryByPlanNum")
-    public Result<?> queryByPlanNum(@RequestParam(name = "plannum", required = true) String plannum) {
+    public Result<?> queryByPlanNum(@RequestParam(name = "plannum", required = true) String plannum,
+                                    @RequestParam(name = "type", required = true) String type) {
+        SyCostAllocation syCostAllocation=new SyCostAllocation();
         if (oConvertUtils.isEmpty(plannum)) {
             throw new JeecgBootException("计划号不能为空!");
         }
-        QueryWrapper<SyCostAllocation> listQueryWrapper = new QueryWrapper<>();
-        listQueryWrapper.eq("plan_num", plannum).eq("del_flag", 0);
-        List<SyCostAllocation> list = syCostAllocationService.list(listQueryWrapper);
-        if (list.size() != 1) {
-            throw new JeecgBootException("数据查询有误,请联系管理员确认!");
-        }
-        SyCostAllocation sycostAllocation = list.get(0);
-        //事故单
-        QueryWrapper<SyCostAllocationAccident> list1QueryWrapper = new QueryWrapper<>();
-        list1QueryWrapper.in("sy_cost_allocation_id", sycostAllocation.getId()).eq("del_flag", 0);
-        List<SyCostAllocationAccident> list1 = syCostAllocationAccidentService.list(list1QueryWrapper);
-        sycostAllocation.setSyCostAllocationAccidentList(list1);
-        //费用支出
-        QueryWrapper<SyCostAllocationCostpay> list2QueryWrapper = new QueryWrapper<>();
-        list2QueryWrapper.in("sy_cost_allocation_id", sycostAllocation.getId()).eq("del_flag", 0);
-        List<SyCostAllocationCostpay> list2 = syCostAllocationCostpayService.list(list2QueryWrapper);
-        sycostAllocation.setSyCostAllocationCostpayList(list2);
-        //面料
-        QueryWrapper<SyCostAllocationFabric> list3QueryWrapper = new QueryWrapper<>();
-        list3QueryWrapper.in("sy_cost_allocation_id", sycostAllocation.getId()).eq("del_flag", 0);
-        List<SyCostAllocationFabric> list3 = syCostAllocationFabricService.list(list3QueryWrapper);
-        sycostAllocation.setSyCostAllocationFabricList(list3);
-        //辅料
-        QueryWrapper<SyCostAllocationIngredient> list4QueryWrapper = new QueryWrapper<>();
-        list4QueryWrapper.in("sy_cost_allocation_id", sycostAllocation.getId()).eq("del_flag", 0);
-        List<SyCostAllocationIngredient> list4 = syCostAllocationIngredientService.list(list4QueryWrapper);
-        sycostAllocation.setSyCostAllocationIngredientList(list4);
-        //发运明细
-        QueryWrapper<SyCostAllocationShipdetail> list5QueryWrapper = new QueryWrapper<>();
-        list5QueryWrapper.in("sy_cost_allocation_id", sycostAllocation.getId()).eq("del_flag", 0);
-        List<SyCostAllocationShipdetail> list5 = syCostAllocationShipdetailService.list(list5QueryWrapper);
-        sycostAllocation.setSyCostAllocationShipdetailList(list5);
+        if(type.equals("query")){
+            syCostAllocation=syCostAllocationService.queryByPlanNum(plannum,type);
+        }else if(type.equals("add")){
 
-        return Result.OK(list);
+        }
+        return Result.OK(syCostAllocation);
     }
 
     /**

+ 134 - 138
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/entity/SyCostAllocation.java

@@ -1,19 +1,21 @@
 package org.jeecg.modules.cost.entity;
 
-import java.io.Serializable;
-import java.util.Date;
-import java.util.List;
-
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
 import com.fasterxml.jackson.annotation.JsonFormat;
-import org.jeecgframework.poi.excel.annotation.ExcelCollection;
-import org.springframework.format.annotation.DateTimeFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.jeecgframework.poi.excel.annotation.ExcelCollection;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
 
 /**
  * @Description: 成本分配主表
@@ -26,128 +28,129 @@ import io.swagger.annotations.ApiModelProperty;
 @ApiModel(value="sy_cost_allocation对象", description="成本分配主表")
 public class SyCostAllocation implements Serializable {
     private static final long serialVersionUID = 1L;
-    
-	/**id*/
-	@TableId(type = IdType.ASSIGN_ID)
-	@ApiModelProperty(value = "id")
-	private String id;
-	/**创建人*/
-	@ApiModelProperty(value = "创建人")
-	private String createBy;
-	/**创建日期*/
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-	@ApiModelProperty(value = "创建日期")
-	private Date createTime;
-	/**修改人*/
-	@ApiModelProperty(value = "修改人")
-	private String updateBy;
-	/**修改日期*/
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+
+    /**id*/
+    @TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "id")
+    private String id;
+    /**创建人*/
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+    /**创建日期*/
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-	@ApiModelProperty(value = "修改日期")
-	private Date updateTime;
-	/**组织*/
-	@ApiModelProperty(value = "组织")
-	private String pkOrg;
-	/**删除状态*/
-	@ApiModelProperty(value = "删除状态")
-	private String delFlag;
-	/**计划单号*/
-	@ApiModelProperty(value = "计划单号")
-	private String planNum;
-	/**款号*/
-	@ApiModelProperty(value = "款号")
-	private String poStyleNum;
-	/**业务员*/
-	@ApiModelProperty(value = "业务员")
-	private String exportSales;
-	/**成衣合同号*/
-	@ApiModelProperty(value = "成衣合同号")
-	private String garmentContractno;
-	/**部门*/
-	@ApiModelProperty(value = "部门")
-	private String department;
-	/**客户简称*/
-	@ApiModelProperty(value = "客户简称")
-	private String customerShortame;
-	/**加工单位*/
-	@ApiModelProperty(value = "加工单位")
-	private String processUnit;
-	/**出运日期*/
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建日期")
+    private Date createTime;
+    /**修改人*/
+    @ApiModelProperty(value = "修改人")
+    private String updateBy;
+    /**修改日期*/
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-	@ApiModelProperty(value = "出运日期")
-	private Date outdata;
-	/**计划数量*/
-	@ApiModelProperty(value = "计划数量")
-	private java.math.BigDecimal planQuantity;
-	/**美元外销总价*/
-	@ApiModelProperty(value = "美元外销总价")
-	private java.math.BigDecimal usdTotalexportprice;
-	/**人民币费用支出*/
-	@ApiModelProperty(value = "人民币费用支出")
-	private java.math.BigDecimal rmbExpense;
-	/**税率*/
-	@ApiModelProperty(value = "税率")
-	private java.math.BigDecimal taxrate;
-	/**成衣件数-实际出货数量*/
-	@ApiModelProperty(value = "成衣件数-实际出货数量")
-	private java.math.BigDecimal actualShipquantity;
-	/**人民币外销金额*/
-	@ApiModelProperty(value = "人民币外销金额")
-	private java.math.BigDecimal rmbExportamount;
-	/**美元费用支出*/
-	@ApiModelProperty(value = "美元费用支出")
-	private java.math.BigDecimal usdExpense;
-	/**人民币加工费*/
-	@ApiModelProperty(value = "人民币加工费")
-	private java.math.BigDecimal rmbProcesscost;
-	/**美元加工费*/
-	@ApiModelProperty(value = "美元加工费")
-	private java.math.BigDecimal usdProcesscost;
-	/**短出数:计划数量和实际出货数量的差额*/
-	@ApiModelProperty(value = "短出数:计划数量和实际出货数量的差额")
-	private java.math.BigDecimal shortseveral;
-	/**短出货值*/
-	@ApiModelProperty(value = "短出货值")
-	private java.math.BigDecimal shortvalue;
-	/**短出面料成本:单件成本*短出数量*/
-	@ApiModelProperty(value = "短出面料成本:单件成本*短出数量")
-	private java.math.BigDecimal fabricshortcost;
-	/**事故单美金金额*/
-	@ApiModelProperty(value = "事故单美金金额")
-	private java.math.BigDecimal accidentUsdamount;
-	/**面料含税成本*/
-	@ApiModelProperty(value = "面料含税成本")
-	private java.math.BigDecimal fabriccostIncludestax;
-	/**辅料含税成本*/
-	@ApiModelProperty(value = "辅料含税成本")
-	private java.math.BigDecimal excipiencostIncludestax;
-	/**销售订单本币总额*/
-	@ApiModelProperty(value = "销售订单本币总额")
-	private java.math.BigDecimal salesordersLocaltotal;
-	/**事故单人民币金额*/
-	@ApiModelProperty(value = "事故单人民币金额")
-	private java.math.BigDecimal accidentcnyAmount;
-	/**面料不含税成本*/
-	@ApiModelProperty(value = "面料不含税成本")
-	private java.math.BigDecimal fabriccostNotincludestax;
-	/**辅料不含税成本*/
-	@ApiModelProperty(value = "辅料不含税成本")
-	private java.math.BigDecimal excipiencostNotincludestax;
-	/**销售订单原币总额*/
-	@ApiModelProperty(value = "销售订单原币总额")
-	private java.math.BigDecimal salesrrdersOriginaltotal;
-	/**制单人*/
-	@ApiModelProperty(value = "制单人")
-	private String preparedBy;
-	/**单据状态:0未保存,1已保存,2已审批*/
-	@ApiModelProperty(value = "单据状态:0未保存,1已保存,2已审批")
-	private Integer billstatus;
-	/**备注*/
-	@ApiModelProperty(value = "备注")
-	private Object remarks;
+    @ApiModelProperty(value = "修改日期")
+    private Date updateTime;
+    /**组织*/
+    @ApiModelProperty(value = "组织")
+    private String pkOrg;
+    /**删除状态*/
+    @ApiModelProperty(value = "删除状态")
+    private String delFlag;
+    /**计划单号*/
+    @ApiModelProperty(value = "计划单号")
+    private String planNum;
+    /**款号*/
+    @ApiModelProperty(value = "款号")
+    private String poStyleNum;
+    /**业务员*/
+    @ApiModelProperty(value = "业务员")
+    private String exportSales;
+    /**成衣合同号*/
+    @ApiModelProperty(value = "成衣合同号")
+    private String garmentContractno;
+    /**部门*/
+    @ApiModelProperty(value = "部门")
+    private String department;
+    /**客户简称*/
+    @ApiModelProperty(value = "客户简称")
+    private String customerShortame;
+    /**加工单位*/
+    @ApiModelProperty(value = "加工单位")
+    private String processUnit;
+    /**出运日期*/
+    @ApiModelProperty(value = "出运日期")
+    private String outdata;
+    /**计划数量*/
+    @ApiModelProperty(value = "计划数量")
+    private java.math.BigDecimal planQuantity;
+    /**美元外销总价*/
+    @ApiModelProperty(value = "美元外销总价")
+    private java.math.BigDecimal usdTotalexportprice;
+    /**人民币费用支出*/
+    @ApiModelProperty(value = "人民币费用支出")
+    private java.math.BigDecimal rmbExpense;
+    /**税率*/
+    @ApiModelProperty(value = "税率")
+    private java.math.BigDecimal taxrate;
+    /**成衣件数-实际出货数量*/
+    @ApiModelProperty(value = "成衣件数-实际出货数量")
+    private java.math.BigDecimal actualShipquantity;
+    /**人民币外销金额*/
+    @ApiModelProperty(value = "人民币外销金额")
+    private java.math.BigDecimal rmbExportamount;
+    /**美元费用支出*/
+    @ApiModelProperty(value = "美元费用支出")
+    private java.math.BigDecimal usdExpense;
+    /**人民币加工费*/
+    @ApiModelProperty(value = "人民币加工费")
+    private java.math.BigDecimal rmbProcesscost;
+    /**美元加工费*/
+    @ApiModelProperty(value = "美元加工费")
+    private java.math.BigDecimal usdProcesscost;
+    /**短出数:计划数量和实际出货数量的差额*/
+    @ApiModelProperty(value = "短出数:计划数量和实际出货数量的差额")
+    private java.math.BigDecimal shortseveral;
+    /**短出货值*/
+    @ApiModelProperty(value = "短出货值")
+    private java.math.BigDecimal shortvalue;
+    /**短出面料成本:单件成本*短出数量*/
+    @ApiModelProperty(value = "短出面料成本:单件成本*短出数量")
+    private java.math.BigDecimal fabricshortcost;
+    /**事故单美金金额*/
+    @ApiModelProperty(value = "事故单美金金额")
+    private java.math.BigDecimal accidentUsdamount;
+    /**面料含税成本*/
+    @ApiModelProperty(value = "面料含税成本")
+    private java.math.BigDecimal fabriccostIncludestax;
+    /**辅料含税成本*/
+    @ApiModelProperty(value = "辅料含税成本")
+    private java.math.BigDecimal excipiencostIncludestax;
+    /**销售订单本币总额*/
+    @ApiModelProperty(value = "销售订单本币总额")
+    private java.math.BigDecimal salesordersLocaltotal;
+    /**事故单人民币金额*/
+    @ApiModelProperty(value = "事故单人民币金额")
+    private java.math.BigDecimal accidentcnyAmount;
+    /**面料不含税成本*/
+    @ApiModelProperty(value = "面料不含税成本")
+    private java.math.BigDecimal fabriccostNotincludestax;
+    /**辅料不含税成本*/
+    @ApiModelProperty(value = "辅料不含税成本")
+    private java.math.BigDecimal excipiencostNotincludestax;
+    /**销售订单原币总额*/
+    @ApiModelProperty(value = "销售订单原币总额")
+    private java.math.BigDecimal salesrrdersOriginaltotal;
+    /**制单人*/
+    @ApiModelProperty(value = "制单人")
+    private String preparedBy;
+    /**单据状态:0未保存,1已保存,2已审批*/
+    @ApiModelProperty(value = "单据状态:0未保存,1已保存,2已审批")
+    private Integer billstatus;
+    /**备注*/
+    @ApiModelProperty(value = "备注")
+    private Object remarks;
+    /**备注*/
+    @ApiModelProperty(value = "备注2,根据权限区分")
+    private Object remarksTwo;
 
     @TableField(exist = false)
     @ExcelCollection(name="成本分配子表_事故单")
@@ -160,17 +163,10 @@ public class SyCostAllocation implements Serializable {
     private List<SyCostAllocationCostpay> syCostAllocationCostpayList;
 
     @TableField(exist = false)
-    @ExcelCollection(name="成本分配子表_面料")
-    @ApiModelProperty(value = "成本分配子表_面料")
-    private List<SyCostAllocationFabric> syCostAllocationFabricList;
+    @ExcelCollection(name="子表_加工单位")
+    @ApiModelProperty(value = "子表_加工单位")
+    private List<JSONObject> processUnitList=new ArrayList<>();
+
 
-    @TableField(exist = false)
-    @ExcelCollection(name="成本分配子表_辅料")
-    @ApiModelProperty(value = "成本分配子表_辅料")
-    private List<SyCostAllocationIngredient> syCostAllocationIngredientList;
 
-    @TableField(exist = false)
-    @ExcelCollection(name="成本分配子表_发运明细")
-    @ApiModelProperty(value = "成本分配子表_发运明细")
-    private List<SyCostAllocationShipdetail> syCostAllocationShipdetailList;
 }

+ 44 - 39
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/entity/SyCostAllocationAccident.java

@@ -23,52 +23,57 @@ import io.swagger.annotations.ApiModelProperty;
 @ApiModel(value="sy_cost_allocation对象", description="成本分配主表")
 public class SyCostAllocationAccident implements Serializable {
     private static final long serialVersionUID = 1L;
-    
-	/**id*/
-	@TableId(type = IdType.ASSIGN_ID)
-	@ApiModelProperty(value = "id")
-	private String id;
-	/**主表id*/
-	@ApiModelProperty(value = "主表id")
-	private String syCostAllocationId;
-	/**创建人*/
+
+    /**id*/
+    @TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "id")
+    private String id;
+    /**主表id*/
+    @ApiModelProperty(value = "主表id")
+    private String syCostAllocationId;
+    /**创建人*/
     @Excel(name = "创建人", width = 15)
-	@ApiModelProperty(value = "创建人")
-	private String createBy;
-	/**创建日期*/
-	@Excel(name = "创建日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+    /**创建日期*/
+    @Excel(name = "创建日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-	@ApiModelProperty(value = "创建日期")
-	private Date createTime;
-	/**修改人*/
+    @ApiModelProperty(value = "创建日期")
+    private Date createTime;
+    /**修改人*/
     @Excel(name = "修改人", width = 15)
-	@ApiModelProperty(value = "修改人")
-	private String updateBy;
-	/**修改日期*/
-	@Excel(name = "修改日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改人")
+    private String updateBy;
+    /**修改日期*/
+    @Excel(name = "修改日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-	@ApiModelProperty(value = "修改日期")
-	private Date updateTime;
-	/**组织*/
+    @ApiModelProperty(value = "修改日期")
+    private Date updateTime;
+    /**组织*/
     @Excel(name = "组织", width = 15)
-	@ApiModelProperty(value = "组织")
-	private String pkOrg;
-	/**删除状态*/
+    @ApiModelProperty(value = "组织")
+    private String pkOrg;
+    /**删除状态*/
     @Excel(name = "删除状态", width = 15)
-	@ApiModelProperty(value = "删除状态")
-	private String delFlag;
-	/**单号*/
+    @ApiModelProperty(value = "删除状态")
+    private String delFlag;
+    /**单号*/
     @Excel(name = "单号", width = 15)
-	@ApiModelProperty(value = "单号")
-	private String accidentNum;
-	/**事故承担方*/
+    @ApiModelProperty(value = "单号")
+    private String accidentNum;
+    /**事故承担方*/
     @Excel(name = "事故承担方", width = 15)
-	@ApiModelProperty(value = "事故承担方")
-	private String accidentUndertaker;
-	/**金额*/
+    @ApiModelProperty(value = "事故承担方")
+    private String accidentUndertaker;
+    /**金额*/
     @Excel(name = "金额", width = 15)
-	@ApiModelProperty(value = "金额")
-	private java.math.BigDecimal amount;
+    @ApiModelProperty(value = "金额")
+    private java.math.BigDecimal amount;
+    /**加工单位*/
+    @Excel(name = "加工单位", width = 15)
+    @ApiModelProperty(value = "加工单位")
+    private String processUnit;
+
 }

+ 55 - 51
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/entity/SyCostAllocationCostpay.java

@@ -23,68 +23,72 @@ import io.swagger.annotations.ApiModelProperty;
 @ApiModel(value="sy_cost_allocation对象", description="成本分配主表")
 public class SyCostAllocationCostpay implements Serializable {
     private static final long serialVersionUID = 1L;
-    
-	/**id*/
-	@TableId(type = IdType.ASSIGN_ID)
-	@ApiModelProperty(value = "id")
-	private String id;
-	/**主表id*/
-	@ApiModelProperty(value = "主表id")
-	private String syCostAllocationId;
-	/**创建人*/
+
+    /**id*/
+    @TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "id")
+    private String id;
+    /**主表id*/
+    @ApiModelProperty(value = "主表id")
+    private String syCostAllocationId;
+    /**创建人*/
     @Excel(name = "创建人", width = 15)
-	@ApiModelProperty(value = "创建人")
-	private String createBy;
-	/**创建日期*/
-	@Excel(name = "创建日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+    /**创建日期*/
+    @Excel(name = "创建日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-	@ApiModelProperty(value = "创建日期")
-	private Date createTime;
-	/**修改人*/
+    @ApiModelProperty(value = "创建日期")
+    private Date createTime;
+    /**修改人*/
     @Excel(name = "修改人", width = 15)
-	@ApiModelProperty(value = "修改人")
-	private String updateBy;
-	/**修改日期*/
-	@Excel(name = "修改日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改人")
+    private String updateBy;
+    /**修改日期*/
+    @Excel(name = "修改日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-	@ApiModelProperty(value = "修改日期")
-	private Date updateTime;
-	/**组织*/
+    @ApiModelProperty(value = "修改日期")
+    private Date updateTime;
+    /**组织*/
     @Excel(name = "组织", width = 15)
-	@ApiModelProperty(value = "组织")
-	private String pkOrg;
-	/**删除状态*/
+    @ApiModelProperty(value = "组织")
+    private String pkOrg;
+    /**删除状态*/
     @Excel(name = "删除状态", width = 15)
-	@ApiModelProperty(value = "删除状态")
-	private String delFlag;
-	/**单号*/
+    @ApiModelProperty(value = "删除状态")
+    private String delFlag;
+    /**单号*/
     @Excel(name = "单号", width = 15)
-	@ApiModelProperty(value = "单号")
-	private String setNo;
-	/**支出单号*/
+    @ApiModelProperty(value = "单号")
+    private String setNo;
+    /**支出单号*/
     @Excel(name = "支出单号", width = 15)
-	@ApiModelProperty(value = "支出单号")
-	private String disbursementSlipNo;
-	/**费用项目*/
+    @ApiModelProperty(value = "支出单号")
+    private String disbursementSlipNo;
+    /**费用项目*/
     @Excel(name = "费用项目", width = 15)
-	@ApiModelProperty(value = "费用项目")
-	private String expenseItem;
-	/**支出本币金额*/
+    @ApiModelProperty(value = "费用项目")
+    private String expenseItem;
+    /**支出本币金额*/
     @Excel(name = "支出本币金额", width = 15)
-	@ApiModelProperty(value = "支出本币金额")
-	private java.math.BigDecimal disbursedLocalmoney;
-	/**支出原币金额*/
+    @ApiModelProperty(value = "支出本币金额")
+    private java.math.BigDecimal disbursedLocalmoney;
+    /**支出原币金额*/
     @Excel(name = "支出原币金额", width = 15)
-	@ApiModelProperty(value = "支出原币金额")
-	private java.math.BigDecimal disbursedOriginalmoney;
-	/**发票号*/
+    @ApiModelProperty(value = "支出原币金额")
+    private java.math.BigDecimal disbursedOriginalmoney;
+    /**发票号*/
     @Excel(name = "发票号", width = 15)
-	@ApiModelProperty(value = "发票号")
-	private String invoicenum;
-	/**制单人*/
+    @ApiModelProperty(value = "发票号")
+    private String invoicenum;
+    /**制单人*/
     @Excel(name = "制单人", width = 15)
-	@ApiModelProperty(value = "制单人")
-	private String preparedBy;
+    @ApiModelProperty(value = "制单人")
+    private String preparedBy;
+    /**加工单位*/
+    @Excel(name = "加工单位", width = 15)
+    @ApiModelProperty(value = "加工单位")
+    private String processUnit;
 }

+ 64 - 60
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/entity/SyCostAllocationFabric.java

@@ -23,80 +23,84 @@ import io.swagger.annotations.ApiModelProperty;
 @ApiModel(value="sy_cost_allocation对象", description="成本分配主表")
 public class SyCostAllocationFabric implements Serializable {
     private static final long serialVersionUID = 1L;
-    
-	/**id*/
-	@TableId(type = IdType.ASSIGN_ID)
-	@ApiModelProperty(value = "id")
-	private String id;
-	/**主表id*/
-	@ApiModelProperty(value = "主表id")
-	private String syCostAllocationId;
-	/**创建人*/
+
+    /**id*/
+    @TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "id")
+    private String id;
+    /**主表id*/
+    @ApiModelProperty(value = "主表id")
+    private String syCostAllocationId;
+    /**创建人*/
     @Excel(name = "创建人", width = 15)
-	@ApiModelProperty(value = "创建人")
-	private String createBy;
-	/**创建日期*/
-	@Excel(name = "创建日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+    /**创建日期*/
+    @Excel(name = "创建日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-	@ApiModelProperty(value = "创建日期")
-	private Date createTime;
-	/**修改人*/
+    @ApiModelProperty(value = "创建日期")
+    private Date createTime;
+    /**修改人*/
     @Excel(name = "修改人", width = 15)
-	@ApiModelProperty(value = "修改人")
-	private String updateBy;
-	/**修改日期*/
-	@Excel(name = "修改日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改人")
+    private String updateBy;
+    /**修改日期*/
+    @Excel(name = "修改日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-	@ApiModelProperty(value = "修改日期")
-	private Date updateTime;
-	/**组织*/
+    @ApiModelProperty(value = "修改日期")
+    private Date updateTime;
+    /**组织*/
     @Excel(name = "组织", width = 15)
-	@ApiModelProperty(value = "组织")
-	private String pkOrg;
-	/**删除状态*/
+    @ApiModelProperty(value = "组织")
+    private String pkOrg;
+    /**删除状态*/
     @Excel(name = "删除状态", width = 15)
-	@ApiModelProperty(value = "删除状态")
-	private String delFlag;
-	/**货物名称*/
+    @ApiModelProperty(value = "删除状态")
+    private String delFlag;
+    /**货物名称*/
     @Excel(name = "货物名称", width = 15)
-	@ApiModelProperty(value = "货物名称")
-	private String goodsName;
-	/**转入数量*/
+    @ApiModelProperty(value = "货物名称")
+    private String goodsName;
+    /**转入数量*/
     @Excel(name = "转入数量", width = 15)
-	@ApiModelProperty(value = "转入数量")
-	private java.math.BigDecimal fabrictransferQuantity;
-	/**转入成本*/
+    @ApiModelProperty(value = "转入数量")
+    private java.math.BigDecimal fabrictransferQuantity;
+    /**转入成本*/
     @Excel(name = "转入成本", width = 15)
-	@ApiModelProperty(value = "转入成本")
-	private java.math.BigDecimal transferCost;
-	/**单耗/件*/
+    @ApiModelProperty(value = "转入成本")
+    private java.math.BigDecimal transferCost;
+    /**单耗/件*/
     @Excel(name = "单耗/件", width = 15)
-	@ApiModelProperty(value = "单耗/件")
-	private java.math.BigDecimal unitConsumption;
-	/**使用数量*/
+    @ApiModelProperty(value = "单耗/件")
+    private java.math.BigDecimal unitConsumption;
+    /**使用数量*/
     @Excel(name = "使用数量", width = 15)
-	@ApiModelProperty(value = "使用数量")
-	private java.math.BigDecimal usageQuantity;
-	/**计划数量*/
+    @ApiModelProperty(value = "使用数量")
+    private java.math.BigDecimal usageQuantity;
+    /**计划数量*/
     @Excel(name = "计划数量", width = 15)
-	@ApiModelProperty(value = "计划数量")
-	private java.math.BigDecimal planQuantity;
-	/**购入数量*/
+    @ApiModelProperty(value = "计划数量")
+    private java.math.BigDecimal planQuantity;
+    /**购入数量*/
     @Excel(name = "购入数量", width = 15)
-	@ApiModelProperty(value = "购入数量")
-	private java.math.BigDecimal purchaseQuantity;
-	/**余下数量*/
+    @ApiModelProperty(value = "购入数量")
+    private java.math.BigDecimal purchaseQuantity;
+    /**余下数量*/
     @Excel(name = "余下数量", width = 15)
-	@ApiModelProperty(value = "余下数量")
-	private java.math.BigDecimal fabricremainingQuantity;
-	/**损耗*/
+    @ApiModelProperty(value = "余下数量")
+    private java.math.BigDecimal fabricremainingQuantity;
+    /**损耗*/
     @Excel(name = "损耗", width = 15)
-	@ApiModelProperty(value = "损耗")
-	private java.math.BigDecimal loss;
-	/**余下数量的成本*/
+    @ApiModelProperty(value = "损耗")
+    private java.math.BigDecimal loss;
+    /**余下数量的成本*/
     @Excel(name = "余下数量的成本", width = 15)
-	@ApiModelProperty(value = "余下数量的成本")
-	private java.math.BigDecimal remainingQuantitycost;
+    @ApiModelProperty(value = "余下数量的成本")
+    private java.math.BigDecimal remainingQuantitycost;
+    /**加工单位*/
+    @Excel(name = "加工单位", width = 15)
+    @ApiModelProperty(value = "加工单位")
+    private String processUnit;
 }

+ 73 - 69
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/entity/SyCostAllocationIngredient.java

@@ -23,92 +23,96 @@ import io.swagger.annotations.ApiModelProperty;
 @ApiModel(value="sy_cost_allocation对象", description="成本分配主表")
 public class SyCostAllocationIngredient implements Serializable {
     private static final long serialVersionUID = 1L;
-    
-	/**id*/
-	@TableId(type = IdType.ASSIGN_ID)
-	@ApiModelProperty(value = "id")
-	private String id;
-	/**主表id*/
-	@ApiModelProperty(value = "主表id")
-	private String syCostAllocationId;
-	/**创建人*/
+
+    /**id*/
+    @TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "id")
+    private String id;
+    /**主表id*/
+    @ApiModelProperty(value = "主表id")
+    private String syCostAllocationId;
+    /**创建人*/
     @Excel(name = "创建人", width = 15)
-	@ApiModelProperty(value = "创建人")
-	private String createBy;
-	/**创建日期*/
-	@Excel(name = "创建日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+    /**创建日期*/
+    @Excel(name = "创建日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-	@ApiModelProperty(value = "创建日期")
-	private Date createTime;
-	/**修改人*/
+    @ApiModelProperty(value = "创建日期")
+    private Date createTime;
+    /**修改人*/
     @Excel(name = "修改人", width = 15)
-	@ApiModelProperty(value = "修改人")
-	private String updateBy;
-	/**修改日期*/
-	@Excel(name = "修改日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改人")
+    private String updateBy;
+    /**修改日期*/
+    @Excel(name = "修改日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-	@ApiModelProperty(value = "修改日期")
-	private Date updateTime;
-	/**组织*/
+    @ApiModelProperty(value = "修改日期")
+    private Date updateTime;
+    /**组织*/
     @Excel(name = "组织", width = 15)
-	@ApiModelProperty(value = "组织")
-	private String pkOrg;
-	/**删除状态*/
+    @ApiModelProperty(value = "组织")
+    private String pkOrg;
+    /**删除状态*/
     @Excel(name = "删除状态", width = 15)
-	@ApiModelProperty(value = "删除状态")
-	private String delFlag;
-	/**货物名称*/
+    @ApiModelProperty(value = "删除状态")
+    private String delFlag;
+    /**货物名称*/
     @Excel(name = "货物名称", width = 15)
-	@ApiModelProperty(value = "货物名称")
-	private String goodsName;
-	/**转入数量*/
+    @ApiModelProperty(value = "货物名称")
+    private String goodsName;
+    /**转入数量*/
     @Excel(name = "转入数量", width = 15)
-	@ApiModelProperty(value = "转入数量")
-	private java.math.BigDecimal ingredientsTransferQuantity;
-	/**转入成本*/
+    @ApiModelProperty(value = "转入数量")
+    private java.math.BigDecimal ingredientsTransferQuantity;
+    /**转入成本*/
     @Excel(name = "转入成本", width = 15)
-	@ApiModelProperty(value = "转入成本")
-	private java.math.BigDecimal transferCost;
-	/**使用数量*/
+    @ApiModelProperty(value = "转入成本")
+    private java.math.BigDecimal transferCost;
+    /**使用数量*/
     @Excel(name = "使用数量", width = 15)
-	@ApiModelProperty(value = "使用数量")
-	private java.math.BigDecimal usageQuantity;
-	/**购入数量*/
+    @ApiModelProperty(value = "使用数量")
+    private java.math.BigDecimal usageQuantity;
+    /**购入数量*/
     @Excel(name = "购入数量", width = 15)
-	@ApiModelProperty(value = "购入数量")
-	private java.math.BigDecimal purchaseQuantity;
-	/**余下数量*/
+    @ApiModelProperty(value = "购入数量")
+    private java.math.BigDecimal purchaseQuantity;
+    /**余下数量*/
     @Excel(name = "余下数量", width = 15)
-	@ApiModelProperty(value = "余下数量")
-	private java.math.BigDecimal ingredientsRemainingQuantity;
-	/**损耗*/
+    @ApiModelProperty(value = "余下数量")
+    private java.math.BigDecimal ingredientsRemainingQuantity;
+    /**损耗*/
     @Excel(name = "损耗", width = 15)
-	@ApiModelProperty(value = "损耗")
-	private java.math.BigDecimal loss;
-	/**人民币金额*/
+    @ApiModelProperty(value = "损耗")
+    private java.math.BigDecimal loss;
+    /**人民币金额*/
     @Excel(name = "人民币金额", width = 15)
-	@ApiModelProperty(value = "人民币金额")
-	private java.math.BigDecimal rmbAmount;
-	/**美元金额*/
+    @ApiModelProperty(value = "人民币金额")
+    private java.math.BigDecimal rmbAmount;
+    /**美元金额*/
     @Excel(name = "美元金额", width = 15)
-	@ApiModelProperty(value = "美元金额")
-	private java.math.BigDecimal usdAmount;
-	/**不含税金额*/
+    @ApiModelProperty(value = "美元金额")
+    private java.math.BigDecimal usdAmount;
+    /**不含税金额*/
     @Excel(name = "不含税金额", width = 15)
-	@ApiModelProperty(value = "不含税金额")
-	private java.math.BigDecimal priceExcludingtax;
-	/**转出率*/
+    @ApiModelProperty(value = "不含税金额")
+    private java.math.BigDecimal priceExcludingtax;
+    /**转出率*/
     @Excel(name = "转出率", width = 15)
-	@ApiModelProperty(value = "转出率")
-	private java.math.BigDecimal transferOutrate;
-	/**进项税转出*/
+    @ApiModelProperty(value = "转出率")
+    private java.math.BigDecimal transferOutrate;
+    /**进项税转出*/
     @Excel(name = "进项税转出", width = 15)
-	@ApiModelProperty(value = "进项税转出")
-	private java.math.BigDecimal inputtaxTransferout;
-	/**用量*/
+    @ApiModelProperty(value = "进项税转出")
+    private java.math.BigDecimal inputtaxTransferout;
+    /**用量*/
     @Excel(name = "用量", width = 15)
-	@ApiModelProperty(value = "用量")
-	private java.math.BigDecimal dosage;
+    @ApiModelProperty(value = "用量")
+    private java.math.BigDecimal dosage;
+    /**加工单位*/
+    @Excel(name = "加工单位", width = 15)
+    @ApiModelProperty(value = "加工单位")
+    private String processUnit;
 }

+ 71 - 69
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/entity/SyCostAllocationShipdetail.java

@@ -23,90 +23,92 @@ import io.swagger.annotations.ApiModelProperty;
 @ApiModel(value="sy_cost_allocation对象", description="成本分配主表")
 public class SyCostAllocationShipdetail implements Serializable {
     private static final long serialVersionUID = 1L;
-    
-	/**id*/
-	@TableId(type = IdType.ASSIGN_ID)
-	@ApiModelProperty(value = "id")
-	private String id;
-	/**主表id*/
-	@ApiModelProperty(value = "主表id")
-	private String syCostAllocationId;
-	/**创建人*/
+
+    /**id*/
+    @TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "id")
+    private String id;
+    /**主表id*/
+    @ApiModelProperty(value = "主表id")
+    private String syCostAllocationId;
+    /**创建人*/
     @Excel(name = "创建人", width = 15)
-	@ApiModelProperty(value = "创建人")
-	private String createBy;
-	/**创建日期*/
-	@Excel(name = "创建日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+    /**创建日期*/
+    @Excel(name = "创建日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-	@ApiModelProperty(value = "创建日期")
-	private Date createTime;
-	/**修改人*/
+    @ApiModelProperty(value = "创建日期")
+    private Date createTime;
+    /**修改人*/
     @Excel(name = "修改人", width = 15)
-	@ApiModelProperty(value = "修改人")
-	private String updateBy;
-	/**修改日期*/
-	@Excel(name = "修改日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改人")
+    private String updateBy;
+    /**修改日期*/
+    @Excel(name = "修改日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-	@ApiModelProperty(value = "修改日期")
-	private Date updateTime;
-	/**组织*/
+    @ApiModelProperty(value = "修改日期")
+    private Date updateTime;
+    /**组织*/
     @Excel(name = "组织", width = 15)
-	@ApiModelProperty(value = "组织")
-	private String pkOrg;
-	/**删除状态*/
+    @ApiModelProperty(value = "组织")
+    private String pkOrg;
+    /**删除状态*/
     @Excel(name = "删除状态", width = 15)
-	@ApiModelProperty(value = "删除状态")
-	private String delFlag;
-	/**发票号码*/
+    @ApiModelProperty(value = "删除状态")
+    private String delFlag;
+    /**发票号码*/
     @Excel(name = "发票号码", width = 15)
-	@ApiModelProperty(value = "发票号码")
-	private String invoiceNum;
-	/**出运日期*/
-	@Excel(name = "出运日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-	@ApiModelProperty(value = "出运日期")
-	private Date outData;
-	/**汇率*/
+    @ApiModelProperty(value = "发票号码")
+    private String invoiceNum;
+    /**出运日期*/
+    @Excel(name = "出运日期", width = 15)
+    @ApiModelProperty(value = "出运日期")
+    private String outdata;
+    /**汇率*/
     @Excel(name = "汇率", width = 15)
-	@ApiModelProperty(value = "汇率")
-	private java.math.BigDecimal exchangeRate;
-	/**订单号*/
+    @ApiModelProperty(value = "汇率")
+    private java.math.BigDecimal exchangeRate;
+    /**订单号*/
     @Excel(name = "订单号", width = 15)
-	@ApiModelProperty(value = "订单号")
-	private String orderNum;
-	/**产品款号*/
+    @ApiModelProperty(value = "订单号")
+    private String orderNum;
+    /**产品款号*/
     @Excel(name = "产品款号", width = 15)
-	@ApiModelProperty(value = "产品款号")
-	private String poStyleNum;
-	/**出货数量*/
+    @ApiModelProperty(value = "产品款号")
+    private String poStyleNum;
+    /**出货数量*/
     @Excel(name = "出货数量", width = 15)
-	@ApiModelProperty(value = "出货数量")
-	private java.math.BigDecimal shipQuantity;
-	/**外销单价*/
+    @ApiModelProperty(value = "出货数量")
+    private java.math.BigDecimal shipQuantity;
+    /**外销单价*/
     @Excel(name = "外销单价", width = 15)
-	@ApiModelProperty(value = "外销单价")
-	private java.math.BigDecimal exportUnitPrice;
-	/**外销总价*/
+    @ApiModelProperty(value = "外销单价")
+    private java.math.BigDecimal exportUnitPrice;
+    /**外销总价*/
     @Excel(name = "外销总价", width = 15)
-	@ApiModelProperty(value = "外销总价")
-	private java.math.BigDecimal exportPrice;
-	/**人民币金额*/
+    @ApiModelProperty(value = "外销总价")
+    private java.math.BigDecimal exportPrice;
+    /**人民币金额*/
     @Excel(name = "人民币金额", width = 15)
-	@ApiModelProperty(value = "人民币金额")
-	private java.math.BigDecimal rmbAmount;
-	/**加工单价(人民币)*/
+    @ApiModelProperty(value = "人民币金额")
+    private java.math.BigDecimal rmbAmount;
+    /**加工单价(人民币)*/
     @Excel(name = "加工单价(人民币)", width = 15)
-	@ApiModelProperty(value = "加工单价(人民币)")
-	private java.math.BigDecimal procesUnitPricermb;
-	/**加工单价(美元)*/
+    @ApiModelProperty(value = "加工单价(人民币)")
+    private java.math.BigDecimal procesUnitPricermb;
+    /**加工单价(美元)*/
     @Excel(name = "加工单价(美元)", width = 15)
-	@ApiModelProperty(value = "加工单价(美元)")
-	private java.math.BigDecimal procesUnitPriceusd;
-	/**加工费*/
+    @ApiModelProperty(value = "加工单价(美元)")
+    private java.math.BigDecimal procesUnitPriceusd;
+    /**加工费*/
     @Excel(name = "加工费", width = 15)
-	@ApiModelProperty(value = "加工费")
-	private java.math.BigDecimal processCost;
+    @ApiModelProperty(value = "加工费")
+    private java.math.BigDecimal processCost;
+    /**加工单位*/
+    @Excel(name = "加工单位", width = 15)
+    @ApiModelProperty(value = "加工单位")
+    private String processUnit;
 }

+ 24 - 22
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/service/ISyCostAllocationService.java

@@ -19,26 +19,28 @@ import java.util.List;
  */
 public interface ISyCostAllocationService extends IService<SyCostAllocation> {
 
-	/**
-	 * 添加一对多
-	 * 
-	 */
-	public void saveMain(SyCostAllocation syCostAllocation, List<SyCostAllocationAccident> syCostAllocationAccidentList, List<SyCostAllocationCostpay> syCostAllocationCostpayList, List<SyCostAllocationFabric> syCostAllocationFabricList, List<SyCostAllocationIngredient> syCostAllocationIngredientList, List<SyCostAllocationShipdetail> syCostAllocationShipdetailList) ;
-	
-	/**
-	 * 修改一对多
-	 * 
-	 */
-	public void updateMain(SyCostAllocation syCostAllocation, List<SyCostAllocationAccident> syCostAllocationAccidentList, List<SyCostAllocationCostpay> syCostAllocationCostpayList, List<SyCostAllocationFabric> syCostAllocationFabricList, List<SyCostAllocationIngredient> syCostAllocationIngredientList, List<SyCostAllocationShipdetail> syCostAllocationShipdetailList);
-	
-	/**
-	 * 删除一对多
-	 */
-	public void delMain(String id);
-	
-	/**
-	 * 批量删除一对多
-	 */
-	public void delBatchMain(Collection<? extends Serializable> idList);
-	
+    /**
+     * 添加一对多
+     *
+     */
+    public void saveMain(SyCostAllocation syCostAllocation, List<SyCostAllocationAccident> syCostAllocationAccidentList, List<SyCostAllocationCostpay> syCostAllocationCostpayList, List<SyCostAllocationFabric> syCostAllocationFabricList, List<SyCostAllocationIngredient> syCostAllocationIngredientList, List<SyCostAllocationShipdetail> syCostAllocationShipdetailList) ;
+
+    /**
+     * 修改一对多
+     *
+     */
+    public void updateMain(SyCostAllocation syCostAllocation, List<SyCostAllocationAccident> syCostAllocationAccidentList, List<SyCostAllocationCostpay> syCostAllocationCostpayList, List<SyCostAllocationFabric> syCostAllocationFabricList, List<SyCostAllocationIngredient> syCostAllocationIngredientList, List<SyCostAllocationShipdetail> syCostAllocationShipdetailList);
+
+    /**
+     * 删除一对多
+     */
+    public void delMain(String id);
+
+    /**
+     * 批量删除一对多
+     */
+    public void delBatchMain(Collection<? extends Serializable> idList);
+
+    //根据单据号查询
+    public SyCostAllocation queryByPlanNum(String plannum,String type);
 }

+ 184 - 120
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/service/impl/SyCostAllocationServiceImpl.java

@@ -1,25 +1,21 @@
 package org.jeecg.modules.cost.service.impl;
 
-import org.jeecg.modules.cost.entity.SyCostAllocation;
-import org.jeecg.modules.cost.entity.SyCostAllocationAccident;
-import org.jeecg.modules.cost.entity.SyCostAllocationCostpay;
-import org.jeecg.modules.cost.entity.SyCostAllocationFabric;
-import org.jeecg.modules.cost.entity.SyCostAllocationIngredient;
-import org.jeecg.modules.cost.entity.SyCostAllocationShipdetail;
-import org.jeecg.modules.cost.mapper.SyCostAllocationAccidentMapper;
-import org.jeecg.modules.cost.mapper.SyCostAllocationCostpayMapper;
-import org.jeecg.modules.cost.mapper.SyCostAllocationFabricMapper;
-import org.jeecg.modules.cost.mapper.SyCostAllocationIngredientMapper;
-import org.jeecg.modules.cost.mapper.SyCostAllocationShipdetailMapper;
-import org.jeecg.modules.cost.mapper.SyCostAllocationMapper;
-import org.jeecg.modules.cost.service.ISyCostAllocationService;
-import org.springframework.stereotype.Service;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.common.exception.JeecgBootException;
+import org.jeecg.modules.cost.entity.*;
+import org.jeecg.modules.cost.mapper.*;
+import org.jeecg.modules.cost.service.*;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+
 import java.io.Serializable;
-import java.util.List;
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * @Description: 成本分配主表
@@ -30,112 +26,180 @@ import java.util.Collection;
 @Service
 public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMapper, SyCostAllocation> implements ISyCostAllocationService {
 
-	@Autowired
-	private SyCostAllocationMapper syCostAllocationMapper;
-	@Autowired
-	private SyCostAllocationAccidentMapper syCostAllocationAccidentMapper;
-	@Autowired
-	private SyCostAllocationCostpayMapper syCostAllocationCostpayMapper;
-	@Autowired
-	private SyCostAllocationFabricMapper syCostAllocationFabricMapper;
-	@Autowired
-	private SyCostAllocationIngredientMapper syCostAllocationIngredientMapper;
-	@Autowired
-	private SyCostAllocationShipdetailMapper syCostAllocationShipdetailMapper;
-	
-	@Override
-	@Transactional
-	public void saveMain(SyCostAllocation syCostAllocation, List<SyCostAllocationAccident> syCostAllocationAccidentList,List<SyCostAllocationCostpay> syCostAllocationCostpayList,List<SyCostAllocationFabric> syCostAllocationFabricList,List<SyCostAllocationIngredient> syCostAllocationIngredientList,List<SyCostAllocationShipdetail> syCostAllocationShipdetailList) {
-		syCostAllocationMapper.insert(syCostAllocation);
-		for(SyCostAllocationAccident entity:syCostAllocationAccidentList) {
-			//外键设置
-			entity.setSyCostAllocationId(syCostAllocation.getId());
-			syCostAllocationAccidentMapper.insert(entity);
-		}
-		for(SyCostAllocationCostpay entity:syCostAllocationCostpayList) {
-			//外键设置
-			entity.setSyCostAllocationId(syCostAllocation.getId());
-			syCostAllocationCostpayMapper.insert(entity);
-		}
-		for(SyCostAllocationFabric entity:syCostAllocationFabricList) {
-			//外键设置
-			entity.setSyCostAllocationId(syCostAllocation.getId());
-			syCostAllocationFabricMapper.insert(entity);
-		}
-		for(SyCostAllocationIngredient entity:syCostAllocationIngredientList) {
-			//外键设置
-			entity.setSyCostAllocationId(syCostAllocation.getId());
-			syCostAllocationIngredientMapper.insert(entity);
-		}
-		for(SyCostAllocationShipdetail entity:syCostAllocationShipdetailList) {
-			//外键设置
-			entity.setSyCostAllocationId(syCostAllocation.getId());
-			syCostAllocationShipdetailMapper.insert(entity);
-		}
-	}
+    @Autowired
+    private SyCostAllocationMapper syCostAllocationMapper;
+    @Autowired
+    private SyCostAllocationAccidentMapper syCostAllocationAccidentMapper;
+    @Autowired
+    private SyCostAllocationCostpayMapper syCostAllocationCostpayMapper;
+    @Autowired
+    private SyCostAllocationFabricMapper syCostAllocationFabricMapper;
+    @Autowired
+    private SyCostAllocationIngredientMapper syCostAllocationIngredientMapper;
+    @Autowired
+    private SyCostAllocationShipdetailMapper syCostAllocationShipdetailMapper;
+    @Autowired
+    private ISyCostAllocationService syCostAllocationService;
+    @Autowired
+    private ISyCostAllocationAccidentService syCostAllocationAccidentService;
+    @Autowired
+    private ISyCostAllocationCostpayService syCostAllocationCostpayService;
+    @Autowired
+    private ISyCostAllocationFabricService syCostAllocationFabricService;
+    @Autowired
+    private ISyCostAllocationIngredientService syCostAllocationIngredientService;
+    @Autowired
+    private ISyCostAllocationShipdetailService syCostAllocationShipdetailService;
+    @Override
+    @Transactional
+    public void saveMain(SyCostAllocation syCostAllocation, List<SyCostAllocationAccident> syCostAllocationAccidentList,List<SyCostAllocationCostpay> syCostAllocationCostpayList,List<SyCostAllocationFabric> syCostAllocationFabricList,List<SyCostAllocationIngredient> syCostAllocationIngredientList,List<SyCostAllocationShipdetail> syCostAllocationShipdetailList) {
+        syCostAllocationMapper.insert(syCostAllocation);
+        for(SyCostAllocationAccident entity:syCostAllocationAccidentList) {
+            //外键设置
+            entity.setSyCostAllocationId(syCostAllocation.getId());
+            syCostAllocationAccidentMapper.insert(entity);
+        }
+        for(SyCostAllocationCostpay entity:syCostAllocationCostpayList) {
+            //外键设置
+            entity.setSyCostAllocationId(syCostAllocation.getId());
+            syCostAllocationCostpayMapper.insert(entity);
+        }
+        for(SyCostAllocationFabric entity:syCostAllocationFabricList) {
+            //外键设置
+            entity.setSyCostAllocationId(syCostAllocation.getId());
+            syCostAllocationFabricMapper.insert(entity);
+        }
+        for(SyCostAllocationIngredient entity:syCostAllocationIngredientList) {
+            //外键设置
+            entity.setSyCostAllocationId(syCostAllocation.getId());
+            syCostAllocationIngredientMapper.insert(entity);
+        }
+        for(SyCostAllocationShipdetail entity:syCostAllocationShipdetailList) {
+            //外键设置
+            entity.setSyCostAllocationId(syCostAllocation.getId());
+            syCostAllocationShipdetailMapper.insert(entity);
+        }
+    }
+
+    @Override
+    @Transactional
+    public void updateMain(SyCostAllocation syCostAllocation,List<SyCostAllocationAccident> syCostAllocationAccidentList,List<SyCostAllocationCostpay> syCostAllocationCostpayList,List<SyCostAllocationFabric> syCostAllocationFabricList,List<SyCostAllocationIngredient> syCostAllocationIngredientList,List<SyCostAllocationShipdetail> syCostAllocationShipdetailList) {
+        syCostAllocationMapper.updateById(syCostAllocation);
+
+        //1.先删除子表数据
+        syCostAllocationAccidentMapper.deleteByMainId(syCostAllocation.getId());
+        syCostAllocationCostpayMapper.deleteByMainId(syCostAllocation.getId());
+        syCostAllocationFabricMapper.deleteByMainId(syCostAllocation.getId());
+        syCostAllocationIngredientMapper.deleteByMainId(syCostAllocation.getId());
+        syCostAllocationShipdetailMapper.deleteByMainId(syCostAllocation.getId());
+
+        //2.子表数据重新插入
+        for(SyCostAllocationAccident entity:syCostAllocationAccidentList) {
+            //外键设置
+            entity.setSyCostAllocationId(syCostAllocation.getId());
+            syCostAllocationAccidentMapper.insert(entity);
+        }
+        for(SyCostAllocationCostpay entity:syCostAllocationCostpayList) {
+            //外键设置
+            entity.setSyCostAllocationId(syCostAllocation.getId());
+            syCostAllocationCostpayMapper.insert(entity);
+        }
+        for(SyCostAllocationFabric entity:syCostAllocationFabricList) {
+            //外键设置
+            entity.setSyCostAllocationId(syCostAllocation.getId());
+            syCostAllocationFabricMapper.insert(entity);
+        }
+        for(SyCostAllocationIngredient entity:syCostAllocationIngredientList) {
+            //外键设置
+            entity.setSyCostAllocationId(syCostAllocation.getId());
+            syCostAllocationIngredientMapper.insert(entity);
+        }
+        for(SyCostAllocationShipdetail entity:syCostAllocationShipdetailList) {
+            //外键设置
+            entity.setSyCostAllocationId(syCostAllocation.getId());
+            syCostAllocationShipdetailMapper.insert(entity);
+        }
+    }
+
+    @Override
+    @Transactional
+    public void delMain(String id) {
+        syCostAllocationAccidentMapper.deleteByMainId(id);
+        syCostAllocationCostpayMapper.deleteByMainId(id);
+        syCostAllocationFabricMapper.deleteByMainId(id);
+        syCostAllocationIngredientMapper.deleteByMainId(id);
+        syCostAllocationShipdetailMapper.deleteByMainId(id);
+        syCostAllocationMapper.deleteById(id);
+    }
+
+    @Override
+    @Transactional
+    public void delBatchMain(Collection<? extends Serializable> idList) {
+        for(Serializable id:idList) {
+            syCostAllocationAccidentMapper.deleteByMainId(id.toString());
+            syCostAllocationCostpayMapper.deleteByMainId(id.toString());
+            syCostAllocationFabricMapper.deleteByMainId(id.toString());
+            syCostAllocationIngredientMapper.deleteByMainId(id.toString());
+            syCostAllocationShipdetailMapper.deleteByMainId(id.toString());
+            syCostAllocationMapper.deleteById(id);
+        }
+    }
+
+    @Override
+    public SyCostAllocation queryByPlanNum(String plannum, String type) {
+        SyCostAllocation syCostAllocation=new SyCostAllocation();
+        if(type.equals("query")){
+            QueryWrapper<SyCostAllocation> listQueryWrapper = new QueryWrapper<>();
+            listQueryWrapper.eq("plan_num", plannum).eq("del_flag", 0);
+            List<SyCostAllocation> list = syCostAllocationService.list(listQueryWrapper);
+            if (list.size() != 1) {
+                throw new JeecgBootException("数据查询有误,请联系管理员确认!");
+            }
+            syCostAllocation = list.get(0);
+
+            //事故单
+            QueryWrapper<SyCostAllocationAccident> list1QueryWrapper = new QueryWrapper<>();
+            list1QueryWrapper.in("sy_cost_allocation_id", syCostAllocation.getId()).eq("del_flag", 0);
+            List<SyCostAllocationAccident> list1 = syCostAllocationAccidentService.list(list1QueryWrapper);
+            syCostAllocation.setSyCostAllocationAccidentList(list1);
+            //费用支出
+            QueryWrapper<SyCostAllocationCostpay> list2QueryWrapper = new QueryWrapper<>();
+            list2QueryWrapper.in("sy_cost_allocation_id", syCostAllocation.getId()).eq("del_flag", 0);
+            List<SyCostAllocationCostpay> list2 = syCostAllocationCostpayService.list(list2QueryWrapper);
+            syCostAllocation.setSyCostAllocationCostpayList(list2);
+            //面料
+            QueryWrapper<SyCostAllocationFabric> list3QueryWrapper = new QueryWrapper<>();
+            list3QueryWrapper.in("sy_cost_allocation_id", syCostAllocation.getId()).eq("del_flag", 0);
+            List<SyCostAllocationFabric> list3 = syCostAllocationFabricService.list(list3QueryWrapper);
+            //辅料
+            QueryWrapper<SyCostAllocationIngredient> list4QueryWrapper = new QueryWrapper<>();
+            list4QueryWrapper.in("sy_cost_allocation_id", syCostAllocation.getId()).eq("del_flag", 0);
+            List<SyCostAllocationIngredient> list4 = syCostAllocationIngredientService.list(list4QueryWrapper);
+            //发运明细
+            QueryWrapper<SyCostAllocationShipdetail> list5QueryWrapper = new QueryWrapper<>();
+            list5QueryWrapper.in("sy_cost_allocation_id", syCostAllocation.getId()).eq("del_flag", 0);
+            List<SyCostAllocationShipdetail> list5 = syCostAllocationShipdetailService.list(list5QueryWrapper);
+
+            List<JSONObject> processUnitList=new ArrayList<>();//子表数据_加工单位集合
+            //获取主表加工单位,拆分获取对应数据
+            String[] processUnit=syCostAllocation.getProcessUnit().split(",");
+            for(int i=0;i<processUnit.length;i++){
+                String unit=processUnit[i];
+                JSONObject jSONObject=new JSONObject();
+                List<SyCostAllocationFabric> list3b = list3.stream().filter(t -> t.getProcessUnit().equals(unit)).collect(Collectors.toList());
+                List<SyCostAllocationIngredient> list4b = list4.stream().filter(t -> t.getProcessUnit().equals(unit)).collect(Collectors.toList());
+                List<SyCostAllocationShipdetail> list5b = list5.stream().filter(t -> t.getProcessUnit().equals(unit)).collect(Collectors.toList());
+                jSONObject.put("syCostAllocationFabricList", list3b);
+                jSONObject.put("syCostAllocationIngredientList",list4b);
+                jSONObject.put("syCostAllocationShipdetailList",list5b);
+                processUnitList.add(jSONObject);
+            }
+            syCostAllocation.setProcessUnitList(processUnitList);
 
-	@Override
-	@Transactional
-	public void updateMain(SyCostAllocation syCostAllocation,List<SyCostAllocationAccident> syCostAllocationAccidentList,List<SyCostAllocationCostpay> syCostAllocationCostpayList,List<SyCostAllocationFabric> syCostAllocationFabricList,List<SyCostAllocationIngredient> syCostAllocationIngredientList,List<SyCostAllocationShipdetail> syCostAllocationShipdetailList) {
-		syCostAllocationMapper.updateById(syCostAllocation);
-		
-		//1.先删除子表数据
-		syCostAllocationAccidentMapper.deleteByMainId(syCostAllocation.getId());
-		syCostAllocationCostpayMapper.deleteByMainId(syCostAllocation.getId());
-		syCostAllocationFabricMapper.deleteByMainId(syCostAllocation.getId());
-		syCostAllocationIngredientMapper.deleteByMainId(syCostAllocation.getId());
-		syCostAllocationShipdetailMapper.deleteByMainId(syCostAllocation.getId());
-		
-		//2.子表数据重新插入
-		for(SyCostAllocationAccident entity:syCostAllocationAccidentList) {
-			//外键设置
-			entity.setSyCostAllocationId(syCostAllocation.getId());
-			syCostAllocationAccidentMapper.insert(entity);
-		}
-		for(SyCostAllocationCostpay entity:syCostAllocationCostpayList) {
-			//外键设置
-			entity.setSyCostAllocationId(syCostAllocation.getId());
-			syCostAllocationCostpayMapper.insert(entity);
-		}
-		for(SyCostAllocationFabric entity:syCostAllocationFabricList) {
-			//外键设置
-			entity.setSyCostAllocationId(syCostAllocation.getId());
-			syCostAllocationFabricMapper.insert(entity);
-		}
-		for(SyCostAllocationIngredient entity:syCostAllocationIngredientList) {
-			//外键设置
-			entity.setSyCostAllocationId(syCostAllocation.getId());
-			syCostAllocationIngredientMapper.insert(entity);
-		}
-		for(SyCostAllocationShipdetail entity:syCostAllocationShipdetailList) {
-			//外键设置
-			entity.setSyCostAllocationId(syCostAllocation.getId());
-			syCostAllocationShipdetailMapper.insert(entity);
-		}
-	}
+        }else if(type.equals("add")){
 
-	@Override
-	@Transactional
-	public void delMain(String id) {
-		syCostAllocationAccidentMapper.deleteByMainId(id);
-		syCostAllocationCostpayMapper.deleteByMainId(id);
-		syCostAllocationFabricMapper.deleteByMainId(id);
-		syCostAllocationIngredientMapper.deleteByMainId(id);
-		syCostAllocationShipdetailMapper.deleteByMainId(id);
-		syCostAllocationMapper.deleteById(id);
-	}
+        }
+        return syCostAllocation;
+    }
 
-	@Override
-	@Transactional
-	public void delBatchMain(Collection<? extends Serializable> idList) {
-		for(Serializable id:idList) {
-			syCostAllocationAccidentMapper.deleteByMainId(id.toString());
-			syCostAllocationCostpayMapper.deleteByMainId(id.toString());
-			syCostAllocationFabricMapper.deleteByMainId(id.toString());
-			syCostAllocationIngredientMapper.deleteByMainId(id.toString());
-			syCostAllocationShipdetailMapper.deleteByMainId(id.toString());
-			syCostAllocationMapper.deleteById(id);
-		}
-	}
-	
 }