Merge branch 'master' of http://10.153.19.25:10105/r/ERP_override
| | |
| | | total.pageTotal = res.data.total.pageTotal |
| | | orderInfo.workOrderDate = res.data.selectDate |
| | | pageTotal.value = res.data.total |
| | | total.value = res.data.total |
| | | produceList.value = produceList.value.concat(deepClone(res.data.data)) |
| | | console.log(produceList.value) |
| | | produceList.value.forEach(item => { |
| | | switch (item.layoutStatus) { |
| | | case "0": |
| | |
| | | total.pageTotal = res.data.total.pageTotal |
| | | orderInfo.workOrderDate = res.data.selectDate |
| | | pageTotal.value = res.data.total |
| | | total.value = res.data.total |
| | | res.data.data.forEach(item => { |
| | | switch (item.layoutStatus) { |
| | | case "0": |
| | |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal=parseInt(res.data.total) |
| | | pageNum.value=1 |
| | | total.value = res.data.total |
| | | produceList.value = deepClone(res.data.data) |
| | | produceList.value.forEach(item => { |
| | | switch (item.layoutStatus) { |
| | |
| | | }, |
| | | {field: 'order.project', title: t('order.project'), showOverflow: "ellipsis"}, |
| | | {field: 'quantity', title: t('order.quantity'),}, |
| | | {field: 'orderDetail.computeGrossArea', title: t('order.area'),}, |
| | | {field: 'computeGrossArea', title: t('order.area'),}, |
| | | {field: 'founder', title: t('processCard.founder'),}, |
| | | {field: 'orderDetail.processingNote', title: t('order.processingNote'),}, |
| | | |
| | |
| | | if (columnIndex === 0) { |
| | | return t('basicData.total') |
| | | } |
| | | const List = ["quantity",'orderDetail.computeGrossArea'] |
| | | const List = ["quantity",'computeGrossArea'] |
| | | if (List.includes(column.field)) { |
| | | return footSum(data, column.field) |
| | | //return footSum(data, column.field) |
| | | return total.value?.[column.field] ?? 0 |
| | | } |
| | | return '' |
| | | }) |
| | |
| | | dataTotal : 0, |
| | | pageSize : 50 |
| | | }) |
| | | |
| | | let orderBomData =ref({ |
| | | productName:[] |
| | | }) |
| | | |
| | | const xGrid = ref() |
| | | const gridOptions = reactive({ |
| | |
| | | const getTableRow = (row,type) => { |
| | | switch (type) { |
| | | case 'edit': { |
| | | dialogTableVisible.value = true |
| | | if (row.orderId!="" && row.orderId!=null){ |
| | | request.post(`/BomData/getOrderBomData/${row.orderId}`,).then((res) => { |
| | | if (res.code == 200 ) { |
| | | orderBomData.value.productName =res.data.data |
| | | console.log(orderBomData.value.productName) |
| | | request.post(`/BomData/getBomDataProduct`,orderBomData.value).then((res) => { |
| | | if (res.code == 200 ) { |
| | | console.log(res.data.data) |
| | | |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | dialogTableVisible.value = true |
| | | } |
| | | |
| | | |
| | | break |
| | | } |
| | | |
| | |
| | | return parts |
| | | }) |
| | | |
| | | //每个产品对应的集合 |
| | | const gridDataMapByProduct = reactive( |
| | | productList.value.reduce((acc, name) => { |
| | | acc[name] = [] |
| | | return acc |
| | | }, {}) |
| | | ) |
| | | // 当前选中 tab 的下标 |
| | | const activeProductIndex = ref(null) |
| | | |
| | | const gridDataMapByProduct = reactive({}) |
| | | |
| | | const handleTabClick = (name) => { |
| | | activeProduct.value = name |
| | | if (!gridDataMapByProduct[name]) { |
| | | gridDataMapByProduct[name] = [] // 首次点击该产品时初始化集合 |
| | | const handleTabClick = (name, index) => { |
| | | activeProductIndex.value = index |
| | | if (!gridDataMapByProduct[index]) { |
| | | gridDataMapByProduct[index] = [] // 初始化 |
| | | } |
| | | xGridByProduct.value?.loadData(gridDataMapByProduct[name]) |
| | | xGridByProduct.value?.loadData(gridDataMapByProduct[index]) |
| | | } |
| | | const getTableRow = (row, type) => { |
| | | if (type !== 'add') return |
| | | const key = activeProduct.value |
| | | if (!key) { |
| | | const key = activeProductIndex.value |
| | | if (key=="" && key==null) { |
| | | ElMessage.warning('请先选择一个产品标签') |
| | | return |
| | | } |
| | | const plainRow = JSON.parse(JSON.stringify(row)) |
| | | const oldData = gridDataMapByProduct[key] || [] |
| | | |
| | | gridDataMapByProduct[key] = [...oldData.map(item => JSON.parse(JSON.stringify(item))), plainRow] |
| | | const oldData = (gridDataMapByProduct[key] || []).map((item) => |
| | | JSON.parse(JSON.stringify(item)) |
| | | ) |
| | | gridDataMapByProduct[key] = [...oldData, plainRow] |
| | | xGridByProduct.value.loadData(gridDataMapByProduct[key]) |
| | | } |
| | | const getTableRowDils = (row,type) =>{ |
| | | switch (type) { |
| | | case 'delete' :{ |
| | | const key = activeProduct.value |
| | | const key = activeProductIndex.value |
| | | gridDataMapByProduct[key] = (gridDataMapByProduct[key] || []).filter( |
| | | item => item.id !== row.id |
| | | ) |
| | |
| | | |
| | | const saveProductBOM = () => { |
| | | productList.value.forEach((name, index) => { |
| | | const rows = gridDataMapByProduct[name] || [] |
| | | const rows = gridDataMapByProduct[index] || [] |
| | | const seq = index + 1 |
| | | |
| | | //给每条数据加上对应层号、产品编号 |
| | |
| | | row.produceId = props.produceId |
| | | }) |
| | | }) |
| | | console.log(gridDataMapByProduct) |
| | | request.post(`/BomData/saveProductBOM`,gridDataMapByProduct).then((res) => { |
| | | if(res.code==200){ |
| | | ElMessage.success(t('basicData.msg.saveSuccess')) |
| | |
| | | <div class="product-tabs"> |
| | | <p |
| | | v-for="(name, i) in productList" |
| | | :key="name + i" |
| | | :key="i" |
| | | class="text item tab" |
| | | :class="{ active: activeProduct === name }" |
| | | :class="{ active: activeProductIndex === i }" |
| | | @click="handleTabClick(name, i)" |
| | | > |
| | | {{ name }} |
| | |
| | | public Result saveProductBOM(@RequestBody Map<String, Object> object){ |
| | | return Result.seccess(bomDataService.saveProductBOMSv(object)); |
| | | } |
| | | @ApiOperation("查询订单BOM对应订单数据") |
| | | @PostMapping("/getOrderBomData/{orderId}") |
| | | public Result getOrderBomData(@PathVariable String orderId){ |
| | | return Result.seccess(bomDataService.getOrderBomDataSv(orderId)); |
| | | } |
| | | |
| | | @ApiOperation("更新基础数据") |
| | | @PostMapping("getBomDataProduct") |
| | | public Result getBomDataProduct(@RequestBody Map<String, Object> object){ |
| | | return Result.seccess(bomDataService.getBomDataProductSv(object)); |
| | | } |
| | | |
| | | } |
| | |
| | | private LocalDate updateTime; |
| | | |
| | | //查询用 |
| | | //流程卡面积 |
| | | @TableField(select = false,exist = false) |
| | | private Double computeGrossArea; |
| | | //标签打印数量 |
| | | @TableField(select = false,exist = false) |
| | | private Integer printQuantity; |
| | |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Mapper |
| | | public interface BomDataMapper extends BaseMapper<BasicData> { |
| | |
| | | Boolean updateMaterialBomDataMp(Integer id, String name, Object consume, Object price, Integer type); |
| | | |
| | | Boolean saveProductBOMMp(Object produceId, Object tabId, Object layer); |
| | | |
| | | List<Map<String, String>> getOrderBomDataMp(String orderId); |
| | | |
| | | List<Map<String, String>> getBOMDetails(Integer productId); |
| | | } |
| | |
| | | package com.example.erp.service.sd; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.example.erp.entity.sd.BasicData; |
| | | import com.example.erp.entity.sd.BasicOtherMoney; |
| | | import com.example.erp.entity.sd.BomBase; |
| | | import com.example.erp.entity.sd.Customer; |
| | | import com.example.erp.entity.pp.FlowCard; |
| | | import com.example.erp.entity.sd.*; |
| | | import com.example.erp.mapper.sd.BomDataMapper; |
| | | import com.example.erp.mapper.sd.BasicOtherMoneyMapper; |
| | | import com.example.erp.mapper.sd.CustomerMapper; |
| | |
| | | |
| | | return true; |
| | | } |
| | | |
| | | public Map<String, Object> getOrderBomDataSv(String orderId) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", bomDataMapper.getOrderBomDataMp(orderId)); |
| | | return map; |
| | | } |
| | | |
| | | public Map<String, Object> getBomDataProductSv(Map<String, Object> object) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();//最终结果 |
| | | List<OrderDetail> orderDetailsList = JSONArray.parseArray(JSONObject.toJSONString(object.get("productName")), OrderDetail.class); |
| | | if (!orderDetailsList.isEmpty()) { |
| | | for (OrderDetail od : orderDetailsList) { |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | itemmap.put("data", bomDataMapper.getBOMDetails(od.getProductId())); |
| | | list.add(itemmap); |
| | | |
| | | } |
| | | } |
| | | map.put("data", list); |
| | | return map; |
| | | } |
| | | } |
| | |
| | | <result column="layout_status" property="layoutStatus"/> |
| | | <result column="merge" property="merge"/> |
| | | <result column="rack" property="rack"/> |
| | | <result column="compute_gross_area" property="computeGrossArea"/> |
| | | <!--接收其他外键实体类数据--> |
| | | <association property="order" javaType="com.example.erp.entity.sd.Order"> |
| | | <result column="project" property="project"/> |
| | |
| | | <result column="compute_gross_area" property="computeGrossArea"/> |
| | | <result column="processing_note" property="processingNote"/> |
| | | <result column="quantity" property="quantity"/> |
| | | <result column="compute_gross_area" property="computeGrossArea"/> |
| | | <result column="perimeter" property="perimeter"/> |
| | | <result column="order_number" property="orderNumber"/> |
| | | <result column="width" property="width"/> |
| | |
| | | |
| | | |
| | | <select id="getPageTotal"> |
| | | SELECT SUM(quantity) as quantity, |
| | | SUM(compute_gross_area) as computeGrossArea, |
| | | CEILING(count(fcd.process_Id)/100) as 'pageTotal', |
| | | count(distinct fcd.process_Id) as 'total' |
| | | from ( |
| | | select |
| | | CEILING(count(a.process_Id)/#{pageSize}) as 'pageTotal', |
| | | count(distinct a.process_Id) as 'total' |
| | | from flow_card as a left join sd.`order` as b on a.order_Id=b.order_id |
| | | a.order_Id, |
| | | a.process_Id, |
| | | c.product_id, |
| | | c.product_name, |
| | | b.project, |
| | | sum(a.quantity) as quantity, |
| | | sum(a.quantity) * c.area as compute_gross_area, |
| | | a.founder, |
| | | c.processing_note, |
| | | b.customer_name, |
| | | layout_status as layout_status, |
| | | a.merge, |
| | | a.rack, |
| | | b.batch |
| | | from (select id,order_id,process_id,order_number, quantity,founder,max(layout_status) as layout_status,create_time,max(merge) as merge,rack from flow_card |
| | | group by process_Id,order_number) as a |
| | | left join sd.`order` as b on a.order_Id=b.order_id |
| | | left join sd.order_detail as c on a.order_Id=c.order_id and a.order_Number=c.order_number |
| | | where date(a.create_time)>=#{selectTime1} and date(a.create_time) <= #{selectTime2} |
| | | and b.create_order>0 |
| | |
| | | <if test="flowCard.merge != null"> |
| | | and a.merge regexp #{flowCard.merge} |
| | | </if> |
| | | |
| | | <if test="flowCard.rack != null and flowCard.rack != ''"> |
| | | and a.rack regexp #{flowCard.rack} |
| | | </if> |
| | | <if test="flowCard.order.customerName != null and flowCard.order.customerName!= ''"> |
| | | and b.customer_name regexp #{flowCard.order.customerName} |
| | | </if> |
| | | group by a.process_Id |
| | | ORDER BY a.id desc |
| | | limit #{offset},#{pageSize}; |
| | | ) as fcd |
| | | </select> |
| | | |
| | | <!--分架查询--> |
| | |
| | | (product_id,base_id,product_layer) |
| | | values (#{produceId},#{tabId},#{layer}) |
| | | </insert> |
| | | |
| | | <select id="getOrderBomDataMp"> |
| | | SELECT DISTINCT product_id,product_name from sd.order_detail where order_id=#{orderId} |
| | | </select> |
| | | |
| | | <select id="getBOMDetails"> |
| | | |
| | | </select> |
| | | </mapper> |