Browse Source

[feat] 生产管理

生产入库
新增设备履历详情Dto实体类
设备履历料号中新增设备履历详情集合
添加保存设备履历后端接口
[feat] 售后管理
设备履历
新增  根据生产单号和关联销售单号查询出货设备履历信息后端接口
新增根据 出货设备号更新出货设备信息后端接口
[fix] 生产管理
生产入库 添加设备履历 创建生产入库和设备履历设置
修改添加设备履历的table展示方法
修改添加设备履历的table的添加一条数据方法
修改添加设备履历的table的逻辑删除一条数据方法
修改 创建生产入库和设备履历设置前端页面的 本次完成数字段
修改 addEquipmentResume添加设备履历按钮的js方法
dev
liuxiaoxu 5 months ago
parent
commit
338061db9c
  1. 5
      ruoyi-admin/src/main/java/com/ruoyi/aftersales/mapper/AfterSalesShippingDeviceMapper.java
  2. 8
      ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/IAfterSalesShippingDeviceService.java
  3. 22
      ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AfterSalesShippingDeviceServiceImpl.java
  4. 37
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java
  5. 3
      ruoyi-admin/src/main/java/com/ruoyi/system/dto/SysEquipMaterialDto.java
  6. 7
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeOrderService.java
  7. 57
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java
  8. 10
      ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml
  9. 150
      ruoyi-admin/src/main/resources/templates/system/makeorder/addEquipmentResume.html
  10. 93
      ruoyi-admin/src/main/resources/templates/system/makeorder/addProduceInbound.html
  11. 2
      ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html

5
ruoyi-admin/src/main/java/com/ruoyi/aftersales/mapper/AfterSalesShippingDeviceMapper.java

@ -97,4 +97,9 @@ public interface AfterSalesShippingDeviceMapper
* 销售单-出库 物料信息关联设备信息 * 销售单-出库 物料信息关联设备信息
*/ */
List<AfterSalesShippingDevice> selectShippingDeviceList(AfterSalesShippingDevice afterSalesShippingDevice); List<AfterSalesShippingDevice> selectShippingDeviceList(AfterSalesShippingDevice afterSalesShippingDevice);
/*
* 根据生产单号和关联销售单号查询出货设备履历信息
* */
List<AfterSalesShippingDevice> selectAfterSalesShippingDeviceByNoAndCode(AfterSalesShippingDevice afterSalesShippingDevice);
} }

8
ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/IAfterSalesShippingDeviceService.java

@ -7,6 +7,7 @@ import com.ruoyi.aftersales.domain.dto.AfterSalesMakeOrderDto;
import com.ruoyi.aftersales.domain.dto.AfterSalesShippingDeviceEditDto; import com.ruoyi.aftersales.domain.dto.AfterSalesShippingDeviceEditDto;
import com.ruoyi.aftersales.domain.dto.WarehouseAndAfterSalesDto; import com.ruoyi.aftersales.domain.dto.WarehouseAndAfterSalesDto;
import com.ruoyi.aftersales.domain.vo.SelectDeviceVO; import com.ruoyi.aftersales.domain.vo.SelectDeviceVO;
import com.ruoyi.system.dto.SysEquipDetailDto;
/** /**
* 出货设备Service接口 * 出货设备Service接口
@ -111,4 +112,11 @@ public interface IAfterSalesShippingDeviceService
* @return * @return
*/ */
List<SelectDeviceVO> selectOptionDevices(String makeNo); List<SelectDeviceVO> selectOptionDevices(String makeNo);
/*
* 根据生产单号和关联销售单号查询出货设备履历信息
* */
List<SysEquipDetailDto> selectAfterSalesShippingDeviceByNoAndCode(AfterSalesShippingDevice afterSalesShippingDevice);
} }

22
ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AfterSalesShippingDeviceServiceImpl.java

@ -13,6 +13,7 @@ import com.ruoyi.aftersales.mapper.AftersalesComplaintNoticeMapper;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.dto.SysEquipDetailDto;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.aftersales.mapper.AfterSalesShippingDeviceMapper; import com.ruoyi.aftersales.mapper.AfterSalesShippingDeviceMapper;
@ -20,6 +21,7 @@ import com.ruoyi.aftersales.domain.AfterSalesShippingDevice;
import com.ruoyi.aftersales.service.IAfterSalesShippingDeviceService; import com.ruoyi.aftersales.service.IAfterSalesShippingDeviceService;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
/** /**
* 出货设备Service业务层处理 * 出货设备Service业务层处理
@ -241,4 +243,24 @@ public class AfterSalesShippingDeviceServiceImpl implements IAfterSalesShippingD
selectDeviceVos.add(selectDeviceVo); selectDeviceVos.add(selectDeviceVo);
return selectDeviceVos; return selectDeviceVos;
} }
/*
* 根据生产单号和关联销售单号查询出货设备履历信息
* */
@Override
public List<SysEquipDetailDto> selectAfterSalesShippingDeviceByNoAndCode(AfterSalesShippingDevice afterSalesShippingDevice) {
List<SysEquipDetailDto> sysEquipDetailDtos = new ArrayList<>();
List<AfterSalesShippingDevice> afterSalesShippingDeviceList = afterSalesShippingDeviceMapper.selectAfterSalesShippingDeviceByNoAndCode(afterSalesShippingDevice);
if (!CollectionUtils.isEmpty(afterSalesShippingDeviceList)){
for (AfterSalesShippingDevice salesShippingDevice : afterSalesShippingDeviceList) {
SysEquipDetailDto sysEquipDetailDto = new SysEquipDetailDto();
sysEquipDetailDto.setEquipmentId(salesShippingDevice.getShippingDeviceId());
sysEquipDetailDto.setSerialNo(salesShippingDevice.getDeviceRunningNumber());
sysEquipDetailDto.setEquipmentModel(salesShippingDevice.getDeviceModelCode());
sysEquipDetailDtos.add(sysEquipDetailDto);
}
}
return sysEquipDetailDtos;
}
} }

37
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java

@ -2,6 +2,8 @@ package com.ruoyi.system.controller;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import com.ruoyi.aftersales.domain.AfterSalesShippingDevice;
import com.ruoyi.aftersales.service.IAfterSalesShippingDeviceService;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
@ -12,10 +14,13 @@ import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.erp.service.IErpMaterialService; import com.ruoyi.erp.service.IErpMaterialService;
import com.ruoyi.financial.domain.FinancialReceivables;
import com.ruoyi.financial.domain.FinancialReceivablesRecords;
import com.ruoyi.system.domain.SysMakeOrder; import com.ruoyi.system.domain.SysMakeOrder;
import com.ruoyi.system.domain.SysMakeorderDept; import com.ruoyi.system.domain.SysMakeorderDept;
import com.ruoyi.system.domain.SysSalesOrder; import com.ruoyi.system.domain.SysSalesOrder;
import com.ruoyi.system.domain.SysSalesOrderChild; import com.ruoyi.system.domain.SysSalesOrderChild;
import com.ruoyi.system.dto.SysEquipDetailDto;
import com.ruoyi.system.dto.SysEquipMaterialDto; import com.ruoyi.system.dto.SysEquipMaterialDto;
import com.ruoyi.system.dto.SysMakeorderDeptDto; import com.ruoyi.system.dto.SysMakeorderDeptDto;
import com.ruoyi.system.dto.SysMakeorderMaterialDto; import com.ruoyi.system.dto.SysMakeorderMaterialDto;
@ -57,6 +62,10 @@ public class SysMakeOrderController extends BaseController
@Autowired @Autowired
private ISysSalesOrderService salesOrderService; private ISysSalesOrderService salesOrderService;
@Autowired
private IAfterSalesShippingDeviceService salesShippingDeviceService;
@GetMapping("/test") @GetMapping("/test")
public AjaxResult test(){ public AjaxResult test(){
sysMakeOrderService.generateMakeOrderBySalesOrderCode("XS20240411007"); sysMakeOrderService.generateMakeOrderBySalesOrderCode("XS20240411007");
@ -209,6 +218,34 @@ public class SysMakeOrderController extends BaseController
} }
/**
* 添加保存设备履历
*/
@ResponseBody
@PostMapping("/addEquipmentResumeSave")
public AjaxResult addEquipmentResumeSave(@RequestBody SysEquipMaterialDto equipMaterialDto)
{
return toAjax(sysMakeOrderService.addEquipmentResumeSave(equipMaterialDto));
}
/**
* 查找已经添加的设备履历
*/
@PostMapping("/getEquipMaterialDetails")
@ResponseBody
public TableDataInfo getEquipMaterialDetails(SysEquipMaterialDto equipMaterialDto){
startPage();
String makeNo = equipMaterialDto.getMakeNo();
String salesOrderCode = equipMaterialDto.getQuoteId();
AfterSalesShippingDevice afterSalesShippingDevice = new AfterSalesShippingDevice();
afterSalesShippingDevice.setMakeNo(makeNo);
afterSalesShippingDevice.setSalesOrderCode(salesOrderCode);
List<SysEquipDetailDto> equipDetailDtos = salesShippingDeviceService.selectAfterSalesShippingDeviceByNoAndCode(afterSalesShippingDevice);
return getDataTable(equipDetailDtos);
}
/** /**
* 部门评审 * 部门评审
* @param makeorderDeptDto * @param makeorderDeptDto

3
ruoyi-admin/src/main/java/com/ruoyi/system/dto/SysEquipMaterialDto.java

@ -26,4 +26,7 @@ public class SysEquipMaterialDto implements Serializable {
private String makeNo; private String makeNo;
private Integer curIndex; private Integer curIndex;
private String inboundOrderNo; private String inboundOrderNo;
//出货设备详情集合
private List<SysEquipDetailDto> sysEquipDetailDtos;
} }

7
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeOrderService.java

@ -1,6 +1,7 @@
package com.ruoyi.system.service; package com.ruoyi.system.service;
import com.ruoyi.system.domain.SysMakeOrder; import com.ruoyi.system.domain.SysMakeOrder;
import com.ruoyi.system.dto.SysEquipMaterialDto;
import com.ruoyi.system.dto.SysMakeorderMaterialDto; import com.ruoyi.system.dto.SysMakeorderMaterialDto;
import com.ruoyi.warehouse.domain.WarehouseStorageOrder; import com.ruoyi.warehouse.domain.WarehouseStorageOrder;
import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail; import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail;
@ -112,4 +113,10 @@ public interface ISysMakeOrderService
* 仓库采购入库单进行入库的时候更新生产订单数据 * 仓库采购入库单进行入库的时候更新生产订单数据
* */ * */
int updateSysMakeOrderByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List<WarehouseStorageOrderDetail> warehouseStorageOrderDetailList); int updateSysMakeOrderByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List<WarehouseStorageOrderDetail> warehouseStorageOrderDetailList);
/**
* 添加保存设备履历
*/
int addEquipmentResumeSave(SysEquipMaterialDto equipMaterialDto);
} }

57
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java

@ -1,8 +1,11 @@
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.ruoyi.aftersales.domain.AfterSalesShippingDevice;
import com.ruoyi.aftersales.mapper.AfterSalesShippingDeviceMapper;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
@ -13,6 +16,8 @@ import com.ruoyi.system.domain.SysMakeOrder;
import com.ruoyi.system.domain.SysMakeorderBom; import com.ruoyi.system.domain.SysMakeorderBom;
import com.ruoyi.system.domain.SysSalesOrderChild; import com.ruoyi.system.domain.SysSalesOrderChild;
import com.ruoyi.system.domain.SysSalesOrderVo; import com.ruoyi.system.domain.SysSalesOrderVo;
import com.ruoyi.system.dto.SysEquipDetailDto;
import com.ruoyi.system.dto.SysEquipMaterialDto;
import com.ruoyi.system.dto.SysMakeorderMaterialDto; import com.ruoyi.system.dto.SysMakeorderMaterialDto;
import com.ruoyi.system.mapper.SysMakeOrderMapper; import com.ruoyi.system.mapper.SysMakeOrderMapper;
import com.ruoyi.system.service.*; import com.ruoyi.system.service.*;
@ -23,6 +28,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
@ -62,6 +68,10 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService
@Autowired @Autowired
private IPurchasePlanService purchasePlanService; private IPurchasePlanService purchasePlanService;
@Autowired
private AfterSalesShippingDeviceMapper afterSalesShippingDeviceMapper;
/** /**
* 查询生产订单 * 查询生产订单
* *
@ -324,4 +334,51 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService
return updateResult; return updateResult;
} }
/**
* 添加保存设备履历
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int addEquipmentResumeSave(SysEquipMaterialDto equipMaterialDto) {
if (CollectionUtils.isEmpty(equipMaterialDto.getSysEquipDetailDtos())) {
log.warn("设备履历详情数据为空");
throw new BusinessException("设备履历详情数据为空");
}
int result = 0;
for (SysEquipDetailDto sysEquipDetailDto : equipMaterialDto.getSysEquipDetailDtos()) {
AfterSalesShippingDevice afterSalesShippingDevice = new AfterSalesShippingDevice();
// 设置通用信息,这些信息对于插入和更新都是共通的
afterSalesShippingDevice.setMakeNo(equipMaterialDto.getMakeNo());
afterSalesShippingDevice.setSalesOrderCode(equipMaterialDto.getQuoteId());
afterSalesShippingDevice.setMaterialNo(equipMaterialDto.getMaterialCode());
afterSalesShippingDevice.setMaterialName(equipMaterialDto.getMaterialName());
afterSalesShippingDevice.setMaterialType(equipMaterialDto.getMaterialType());
afterSalesShippingDevice.setMaterialBrand(equipMaterialDto.getBrand());
afterSalesShippingDevice.setMaterialUnit(equipMaterialDto.getUnit());
afterSalesShippingDevice.setMaterialDescribe(equipMaterialDto.getDescribe());
afterSalesShippingDevice.setDeviceModelCode(sysEquipDetailDto.getEquipmentModel());
afterSalesShippingDevice.setDeviceRunningNumber(sysEquipDetailDto.getSerialNo());
if (StringUtils.isEmpty(sysEquipDetailDto.getEquipmentId())) {
// 如果设备ID为空,说明是新记录,需要插入
afterSalesShippingDevice.setShippingDeviceId(redisCache.generateBillNo("CHSB"));
afterSalesShippingDevice.setCreateBy(ShiroUtils.getLoginName());
afterSalesShippingDevice.setCreateTime(new Date());
result += afterSalesShippingDeviceMapper.insertAfterSalesShippingDevice(afterSalesShippingDevice);
} else {
// 设备ID不为空,假设需要更新逻辑(根据业务需求确定是否需要此分支)
afterSalesShippingDevice.setShippingDeviceId(sysEquipDetailDto.getEquipmentId()); // 确保ID设置正确
afterSalesShippingDevice.setUpdateBy(ShiroUtils.getLoginName());
afterSalesShippingDevice.setUpdateTime(new Date());
// 注意:这里假设了updateAfterSalesShippingDevice方法是存在的且逻辑正确,根据实际情况调整
result += afterSalesShippingDeviceMapper.updateAfterSalesShippingDevice(afterSalesShippingDevice);
}
}
return result;
}
} }

10
ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml

@ -94,11 +94,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectAfterSalesShippingDeviceByNoAndCode" parameterType="AfterSalesShippingDevice" resultMap="AfterSalesShippingDeviceResult">
<include refid="selectAfterSalesShippingDeviceVo"/>
where make_no = #{makeNo}
and sales_order_code = #{salesOrderCode}
</select>
<insert id="insertAfterSalesShippingDevice" parameterType="AfterSalesShippingDevice" useGeneratedKeys="true" keyProperty="shippingDeviceCode"> <insert id="insertAfterSalesShippingDevice" parameterType="AfterSalesShippingDevice" useGeneratedKeys="true" keyProperty="shippingDeviceCode">
insert into aftersales_shipping_device insert into aftersales_shipping_device
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="shippingDeviceId != null and shippingDeviceId != ''">shipping_device_id,</if> <if test="shippingDeviceId != null and shippingDeviceId != ''">shipping_device_id,</if>
<if test="salesOrderCode != null">sales_order_code,</if>
<if test="makeNo != null">make_no,</if> <if test="makeNo != null">make_no,</if>
<if test="materialNo != null">material_no,</if> <if test="materialNo != null">material_no,</if>
<if test="materialPhotourl != null">material_photoUrl,</if> <if test="materialPhotourl != null">material_photoUrl,</if>
@ -136,6 +144,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="shippingDeviceId != null and shippingDeviceId != ''">#{shippingDeviceId},</if> <if test="shippingDeviceId != null and shippingDeviceId != ''">#{shippingDeviceId},</if>
<if test="salesOrderCode != null">#{salesOrderCode},</if>
<if test="makeNo != null">#{makeNo},</if> <if test="makeNo != null">#{makeNo},</if>
<if test="materialNo != null">#{materialNo},</if> <if test="materialNo != null">#{materialNo},</if>
<if test="materialPhotourl != null">#{materialPhotourl},</if> <if test="materialPhotourl != null">#{materialPhotourl},</if>
@ -177,6 +186,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update aftersales_shipping_device update aftersales_shipping_device
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="shippingDeviceId != null and shippingDeviceId != ''">shipping_device_id = #{shippingDeviceId},</if> <if test="shippingDeviceId != null and shippingDeviceId != ''">shipping_device_id = #{shippingDeviceId},</if>
<if test="salesOrderCode != null">sales_order_code = #{salesOrderCode},</if>
<if test="makeNo != null">make_no = #{makeNo},</if> <if test="makeNo != null">make_no = #{makeNo},</if>
<if test="materialNo != null">material_no = #{materialNo},</if> <if test="materialNo != null">material_no = #{materialNo},</if>
<if test="materialPhotourl != null">material_photoUrl = #{materialPhotourl},</if> <if test="materialPhotourl != null">material_photoUrl = #{materialPhotourl},</if>

150
ruoyi-admin/src/main/resources/templates/system/makeorder/addEquipmentResume.html

@ -102,114 +102,186 @@
</div> </div>
</div> </div>
</div> </div>
<!-- <div class="row">-->
<!-- <button type="button" class="btn btn-white btn-sm" onclick="addRow()"><i class="fa fa-plus"> 增加</i></button>-->
<!-- <button type="button" class="btn btn-white btn-sm" onclick="sub.delRow()"><i class="fa fa-minus"> 删除</i></button>-->
<!-- <div class="col-sm-12 select-table table-striped">-->
<!-- <table id="bootstrap-sub-table-1"></table>-->
<!-- </div>-->
<!-- </div>-->
</form>
<div class="container">
<!-- 增加设备履历 -->
<div class="row">
<div class="col-sm-12 d-flex align-items-center">
<a class="btn btn-success ml-auto" onclick="addEquipMaterialDetail()">
<i class="fa fa-plus"></i> 增加
</a>
</div>
</div>
<div class="row"> <div class="row">
<button type="button" class="btn btn-white btn-sm" onclick="addRow()"><i class="fa fa-plus"> 增加</i></button>
<button type="button" class="btn btn-white btn-sm" onclick="sub.delRow()"><i class="fa fa-minus"> 删除</i></button>
<div class="col-sm-12 select-table table-striped"> <div class="col-sm-12 select-table table-striped">
<table id="bootstrap-sub-table-1"></table> <table id="form-equipMaterialDetail-add"></table>
</div>
</div> </div>
</div> </div>
</form>
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" /> <th:block th:include="include :: select2-js" />
<th:block th:include="include :: bootstrap-table-editable-js" />
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "erp/equipmentResume";
var equipMaterial = [[${equipMaterial}]];
var prefix = ctx + "system/makeorder";
// var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
$(function(){ $(function(){
var options = { var options = {
id: 'bootstrap-sub-table-1', id: "form-equipMaterialDetail-add",
url: prefix + "/getEquipMaterialDetails",
pagination: false, pagination: false,
showSearch: false, showSearch: false,
showRefresh: false, showRefresh: false,
showToggle: false, showToggle: false,
showColumns: false, showColumns: false,
queryParams:queryParams,
sidePagination: "client", sidePagination: "client",
columns: [{ columns: [{
checkbox: true checkbox: true
}, },
{ {
field: 'index', field: 'equipmentIndex',
align: 'center', align: 'center',
title: "序号", title: "序号",
formatter: function (value, row, index) { formatter: function (value, row, index) {
var columnIndex = $.common.sprintf("<input type='hidden' name='equipResumes[%s].index' value='%s'>", index,$.table.serialNumber(index)); // 使用bootstrap-table的内置序号生成
var columnId = $.common.sprintf("<input type='hidden' name='equipResumes[%s].id' value='%s'>", index, row.id); return index + 1;
return columnIndex + $.table.serialNumber(index) + columnId;
} }
}, },
{ {
field: 'equipmentId', field: 'equipmentId',
align: 'center', align: 'center',
title: '出货设备id', title: '出货设备id',
formatter: function(value, row, index) { // formatter: function(value, row, index) {
return '添加后系统自动生成'; // return '添加后系统自动生成';
} // }
}, },
{ {
field: 'equipmentModel', field: 'equipmentModel',
align: 'center', align: 'center',
title: '设备型号', title: '设备型号',
formatter: function(value, row, index) { editable:true
var html = $.common.sprintf("<input class='form-control equipmentModel' type='text' name='equipResumes[%s].equipmentModel' value='%s'>", index, value);
return html;
}
}, },
{ {
field: 'serialNo', field: 'serialNo',
align: 'center', align: 'center',
title: '流水号', title: '流水号',
formatter: function(value, row, index) { editable:true
var html = $.common.sprintf("<input class='form-control' type='text' name='equipResumes[%s].serialNo' value='%s'>", index, value);
return html;
}
}, },
{ {
field: 'producePic', field: 'producePic',
align: 'center', align: 'center',
title: '生产图片', title: '生产图片',
formatter: function(value, row, index) { editable:true
}
}, },
{ {
title: '操作', title: '操作',
align: 'center', align: 'center',
formatter: function(value, row, index) { formatter: function (value, row, index) {
var value = $.common.isNotEmpty(row.index) ? row.index : $.table.serialNumber(index); return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(' + index + ')"><i class="fa fa-remove"></i>删除</a>';
return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + value + '\')"><i class="fa fa-remove"></i>删除</a>';
} }
}] }
]
}; };
$.table.init(options); $.table.init(options);
}) })
function addRow() { function queryParams(params) {
var count = $("#bootstrap-sub-table-1").bootstrapTable('getData').length; var curParams = {
var row = { // 传递参数查询参数
index: $.table.serialNumber(count), makeNo: equipMaterial.makeNo,
quoteId: equipMaterial.quoteId
};
return curParams;
}
//添加设备履历
function addEquipMaterialDetail() {
var newRow = {
equipmentId: "", equipmentId: "",
equipmentModel: "", equipmentModel: "",
serialNo: "", serialNo: "",
producePic: "", producePic: "",
} // 假设每个新增的行都有一个唯一的标识符或者索引,这里为了演示直接使用时间戳
sub.addRow(row); equipmentIndex: new Date().getTime(),
};
$('#form-equipMaterialDetail-add').bootstrapTable('append', newRow);
} }
function removeRow(index) {
var data = $('#form-equipMaterialDetail-add').bootstrapTable('getData');
var row = data[index]; // 获取要删除的行数据
if (row) {
$('#form-equipMaterialDetail-add').bootstrapTable('remove', {
field: 'equipmentIndex',
values: [row.equipmentIndex]
});
}
}
$("#form-equipMaterial-add").validate({ $("#form-equipMaterial-add").validate({
focusCleanup: true focusCleanup: true
}); });
/*function submitHandler() { /*
if ($.validate.form()) { * 提交设备履历信息
$.operate.save(prefix + "/edit", $('#form-equipMaterial-add').serialize()); * */
function submitHandler() {
// 获取表单数据
const equipMaterialData = $("#form-equipMaterial-add").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据
// var table = $('#form-equipMaterialDetail-add').bootstrapTable('getData');
//获取选中复选框行的数据
const selectedRows = $("#form-equipMaterialDetail-add").bootstrapTable('getSelections');
// 检查表格数据是否为空
if (selectedRows.length===0){
$.modal.alertWarning("请至少添加一条数据后再保存!");
return;
}
// 将表数据转换成与complaintNoticeData格式一致的数组
var equipDetailDataList = selectedRows.map(function(item) {
// 根据实际字段名调整
return {
"equipmentId": item.equipmentId,
"equipmentModel": item.equipmentModel,
"serialNo": item.serialNo,
"producePic": item.producePic
// ...其他字段
};
});
// 合并表单数据和表格数据
const combinedData = Object.assign({}, equipMaterialData, { sysEquipDetailDtos: equipDetailDataList });
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/addEquipmentResumeSave", jsonData);
} }
}*/
</script> </script>
</body> </body>
</html> </html>

93
ruoyi-admin/src/main/resources/templates/system/makeorder/addProduceInbound.html

@ -46,6 +46,7 @@
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" /> <th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-table-editable-js"/>
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "system/makeorder"; var prefix = ctx + "system/makeorder";
@ -142,7 +143,7 @@
{ {
field: 'processMethod', field: 'processMethod',
align: 'center', align: 'center',
title: '半成品类型', title: '加工方式',
formatter: function(value, row, index) { formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value); return $.table.selectDictLabel(processMethodDatas, value);
} }
@ -162,18 +163,23 @@
align: 'center', align: 'center',
title: '已完成数' title: '已完成数'
}, },
// {
// field: 'currentNum',
// title: '本次完成数',
// formatter: function (value,row,index){
// var curIndex = index;
// // 物料类型是成品,通过添加设备履历表计算数量
// if(row.materialType == 'chcpsb'){
// return '<input readonly class = "form-control" data-id = "currentNum_'+curIndex+'" name="inboundDetails['+curIndex+'].currentNum">' +
// '<input class = "form-control hidden" data-id = "equipResumeArrayStr_'+curIndex+'" name="inboundDetails['+curIndex+'].equipResumeArrayStr">';
// }
// return '<input class = "form-control" data-id = "currentNum_'+curIndex+'" name="inboundDetails['+curIndex+'].currentNum">';
// }
// },
{ {
field: 'currentNum', field: 'currentNum',
title: '本次完成数', title: '本次完成数',
formatter: function (value,row,index){ editable:true
var curIndex = index;
// 物料类型是成品,通过添加设备履历表计算数量
if(row.materialType == 'chcpsb'){
return '<input readonly class = "form-control" data-id = "currentNum_'+curIndex+'" name="inboundDetails['+curIndex+'].currentNum">' +
'<input class = "form-control hidden" data-id = "equipResumeArrayStr_'+curIndex+'" name="inboundDetails['+curIndex+'].equipResumeArrayStr">';
}
return '<input class = "form-control" data-id = "currentNum_'+curIndex+'" name="inboundDetails['+curIndex+'].currentNum">';
}
}, },
{ {
title: '操作', title: '操作',
@ -377,41 +383,42 @@
function addEquipmentResume(curIndex,materialCode){ function addEquipmentResume(curIndex,materialCode){
var url = prefix + "/addEquipmentResume?makeNo="+$("#makeNo").val()+"&saleNo="+$("#saleNo").val()+"&materialNo="+materialCode+"&curIndex="+curIndex; var url = prefix + "/addEquipmentResume?makeNo="+$("#makeNo").val()+"&saleNo="+$("#saleNo").val()+"&materialNo="+materialCode+"&curIndex="+curIndex;
var options = { // var options = {
title: '设备履历表', // title: '设备履历表',
url: url, // url: url,
callBack: doSubmit // // callBack: doSubmit
}; // };
$.modal.openOptions(options); // $.modal.openOptions(options);
$.modal.open("设备履历表",url);
} }
function doSubmit(index, layero,uniqueId) { // function doSubmit(index, layero,uniqueId) {
debugger // // debugger
var iframeWin = window[layero.find('iframe')[0]['name']]; // var iframeWin = window[layero.find('iframe')[0]['name']];
// 行取不到 // // 行取不到
// var data = iframeWin.$('#bootstrap-sub-table-1').bootstrapTable('getData'); // // var data = iframeWin.$('#bootstrap-sub-table-1').bootstrapTable('getData');
// alert(JSON.stringify(data)); // // alert(JSON.stringify(data));
//
// 取不到 // // 取不到
// var options = iframeWin.$('#bootstrap-sub-table-1').bootstrapTable('getOptions'); // // var options = iframeWin.$('#bootstrap-sub-table-1').bootstrapTable('getOptions');
// var data = options.data; // // var data = options.data;
// alert(JSON.stringify(data)); // // alert(JSON.stringify(data));
//
var formData = iframeWin.$("#form-equipMaterial-add").serializeArray(); // var formData = iframeWin.$("#form-equipMaterial-add").serializeArray();
var formObj = serializeObject(formData); // var formObj = serializeObject(formData);
var formObjStr = JSON.stringify(formObj); // var formObjStr = JSON.stringify(formObj);
alert(formObjStr); // // alert(formObjStr);
// 关闭弹出框 // // 关闭弹出框
layer.close(index); // layer.close(index);
var curIndex = formObj.curIndex; // var curIndex = formObj.curIndex;
if(formObj.equipResumes){ // if(formObj.equipResumes){
var currentNum = formObj.equipResumes.length; // var currentNum = formObj.equipResumes.length;
var equipResumeArrayStr = JSON.stringify(formObj.equipResumes); // var equipResumeArrayStr = JSON.stringify(formObj.equipResumes);
$('[data-id="currentNum_'+curIndex+'"]').val(currentNum); // $('[data-id="currentNum_'+curIndex+'"]').val(currentNum);
$('[data-id="equipResumeArrayStr_'+curIndex+'"]').val(equipResumeArrayStr); // $('[data-id="equipResumeArrayStr_'+curIndex+'"]').val(equipResumeArrayStr);
} // }
//
} // }
function serializeObject(formData) { function serializeObject(formData) {
var obj = {}; var obj = {};

2
ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html

@ -249,7 +249,7 @@
(row.eceiptStatus == '7' || row.eceiptStatus == '8')){ (row.eceiptStatus == '7' || row.eceiptStatus == '8')){
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.modal.open(\'添加领料单\',\'' + prefix+"/addpick/"+row.id + '\')">领料</a> '); actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.modal.open(\'添加领料单\',\'' + prefix+"/addpick/"+row.id + '\')">领料</a> ');
} }
// 委内入库 // 委内入库 对应生产中
if(row.makeStatus == '4' || row.makeStatus == '5'){ if(row.makeStatus == '4' || row.makeStatus == '5'){
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.modal.open(\'创建委内入库单\',\'' + prefix+"/addProcessInbound/"+row.id + '\')">委内入库</a> '); actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.modal.open(\'创建委内入库单\',\'' + prefix+"/addProcessInbound/"+row.id + '\')">委内入库</a> ');
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.modal.open(\'创建生产入库和设备履历设置\',\'' + prefix+"/addProduceInbound/"+row.id + '\')">生产入库</a> '); actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.modal.open(\'创建生产入库和设备履历设置\',\'' + prefix+"/addProduceInbound/"+row.id + '\')">生产入库</a> ');

Loading…
Cancel
Save