Browse Source

[fix] 生产管理 仓库管理 销售管理

修改销售订单的生产状态,引用生产订单的生产状态字典
修复生产-出库前端页面 生产单号和申请人数据传递不到后端问题
新增保存生产单-出库 后端接口
新增根据 销售单号更新销售订单数据后端接口
修改仓库入库单 异常提醒由 RuntimeException 改为自定义业务异常BusinessException
dev
liuxiaoxu 5 months ago
parent
commit
881f3177d3
  1. 7
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderMapper.java
  2. 2
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseOutOrderController.java
  3. 5
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderService.java
  4. 85
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java
  5. 5
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java
  6. 70
      ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderMapper.xml
  7. 2
      ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html
  8. 6
      ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/makeOutWarehouse.html

7
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderMapper.java

@ -61,4 +61,11 @@ public interface SysSalesOrderMapper
* @return 结果
*/
public int deleteSysSalesOrderByIds(String[] salesOrderIds);
/**
* 根据销售单号更新销售订单数据
* @param sysSalesOrder 销售订单
* @return 结果
* */
int updateSysSalesOrderBySalesOrderCode(SysSalesOrder sysSalesOrder);
}

2
ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseOutOrderController.java

@ -263,7 +263,7 @@ public class WarehouseOutOrderController extends BaseController
@ResponseBody
public AjaxResult makeOutWarehouseSave(@RequestBody WarehouseOutOrder warehouseOutOrder)
{
return toAjax(warehouseOutOrderService.updatePrepareMaterial(warehouseOutOrder));
return toAjax(warehouseOutOrderService.updateMakeOutWarehouse(warehouseOutOrder));
}

5
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderService.java

@ -95,4 +95,9 @@ public interface IWarehouseOutOrderService
* 领料单审核通过后生成出库单
* */
int generateWarehouseOutOrderByMakeorderPick(SysMakeorderPickVo sysMakeorderPickVo);
/*
* 生产单-出库
* */
int updateMakeOutWarehouse(WarehouseOutOrder warehouseOutOrder);
}

85
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java

@ -4,13 +4,18 @@ import java.util.Date;
import java.util.List;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.SysMakeOrder;
import com.ruoyi.system.domain.SysMakeorderPickDetail;
import com.ruoyi.system.domain.SysMakeorderPickVo;
import com.ruoyi.system.domain.SysSalesOrder;
import com.ruoyi.system.mapper.SysMakeOrderMapper;
import com.ruoyi.system.mapper.SysMakeorderPickDetailMapper;
import com.ruoyi.system.mapper.SysMakeorderPickMapper;
import com.ruoyi.system.mapper.SysSalesOrderMapper;
import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail;
import com.ruoyi.warehouse.mapper.WarehouseOutOrderDetailMapper;
import lombok.extern.slf4j.Slf4j;
@ -21,6 +26,7 @@ import com.ruoyi.warehouse.domain.WarehouseOutOrder;
import com.ruoyi.warehouse.service.IWarehouseOutOrderService;
import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
/**
* 仓库出库单Service业务层处理
@ -44,6 +50,12 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
@Autowired
private SysMakeorderPickDetailMapper makeorderPickDetailMapper;
@Autowired
private SysMakeOrderMapper sysMakeOrderMapper;
@Autowired
private SysSalesOrderMapper sysSalesOrderMapper;
@Autowired
private RedisCache redisCache;
@ -238,7 +250,7 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
SysMakeorderPickVo tempSysMakeorderPickVo = sysMakeorderPickMapper.selectSysMakeorderPickById(sysMakeorderPickVo.getId());
if (tempSysMakeorderPickVo == null){
log.warn("生产领料单数据为空:{}",sysMakeorderPickVo.getId());
throw new RuntimeException("生产领料单数据为空:" + sysMakeorderPickVo.getId());
throw new BusinessException("生产领料单数据为空:" + sysMakeorderPickVo.getId());
}
String outOrderCode = redisCache.generateBillNo("CK");
@ -259,7 +271,7 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
int insertResult = warehouseOutOrderMapper.insertWarehouseOutOrder(warehouseOutOrder);
if (insertResult <= 0){
log.warn("添加出库单信息失败");
throw new RuntimeException("添加出库单信息失败");
throw new BusinessException("添加出库单信息失败");
}
//生成出库单详情相关信息
generateWarehouseOutOrder(sysMakeorderPickVo, tempSysMakeorderPickVo, outOrderCode);
@ -304,4 +316,73 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
outOrderDetailMapper.insertWarehouseOutOrderDetail(warehouseOutOrderDetail);
}
}
/*
* 生产单-出库
* */
@Transactional(rollbackFor = Exception.class)
@Override
public int updateMakeOutWarehouse(WarehouseOutOrder warehouseOutOrder) {
String loginName = ShiroUtils.getLoginName();
// 参数校验
if (warehouseOutOrder == null || StringUtils.isEmpty(warehouseOutOrder.getMakeNo())) {
throw new BusinessException("更新出库单信息失败:缺少必要参数");
}
warehouseOutOrder.setUpdateBy(loginName);
warehouseOutOrder.setUpdateTime(new Date());
//表面已出库
warehouseOutOrder.setWarehouseOutStatus("7");
warehouseOutOrder.setOutOrderTime(new Date());
warehouseOutOrderMapper.updateWarehouseOutOrder(warehouseOutOrder);
//更新生产订单信息
SysMakeOrder sysMakeOrder = new SysMakeOrder();
sysMakeOrder.setMakeNo(warehouseOutOrder.getMakeNo());
sysMakeOrder.setUpdateBy(loginName);
sysMakeOrder.setUpdateTime(new Date());
//表示生产中
sysMakeOrder.setMakeStatus("4");
int updateMakeOrderResult = sysMakeOrderMapper.updateByMakeNo(sysMakeOrder);
if (updateMakeOrderResult <= 0){
log.warn("更新生产订单信息失败");
throw new BusinessException("更新生产订单信息失败");
}
//根据生产订单号查询数据库中生产订单的销售订单号
SysMakeOrder tempSysMakeOrder = sysMakeOrderMapper.selectSaleNoByMakeNo(warehouseOutOrder.getMakeNo());
if (tempSysMakeOrder == null || StringUtils.isEmpty(tempSysMakeOrder.getSaleNo())) {
throw new BusinessException("无法找到与生产订单关联的销售订单");
}
//更新销售订单信息
SysSalesOrder sysSalesOrder = new SysSalesOrder();
sysSalesOrder.setSalesOrderCode(tempSysMakeOrder.getSaleNo());
sysSalesOrder.setUpdateBy(loginName);
sysSalesOrder.setUpdateTime(new Date());
//表示生产中
sysSalesOrder.setMakeStatus("4");
int updateSalesOrderResult = sysSalesOrderMapper.updateSysSalesOrderBySalesOrderCode(sysSalesOrder);
if (updateSalesOrderResult <= 0){
log.warn("更新销售订单信息失败");
throw new BusinessException("更新销售订单信息失败");
}
List<WarehouseOutOrderDetail> warehouseOutOrderDetailList = warehouseOutOrder.getWarehouseOutOrderDetailList();
if (CollectionUtils.isEmpty(warehouseOutOrderDetailList)){
log.warn("保存生产单出库,物料列表信息为空:{}",warehouseOutOrder);
}else {
int updateRows = 0;
for (WarehouseOutOrderDetail warehouseOutOrderDetail : warehouseOutOrderDetailList) {
warehouseOutOrderDetail.setUpdateBy(loginName);
warehouseOutOrderDetail.setUpdateTime(new Date());
warehouseOutOrderDetail.setRemark(warehouseOutOrder.getRemark());
//更新数据库记录
updateRows += outOrderDetailMapper.updateWarehouseOutOrderDetail(warehouseOutOrderDetail);
}
return updateRows;
}
return 0;
}
}

5
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java

@ -5,6 +5,7 @@ import java.util.Date;
import java.util.List;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
@ -155,7 +156,7 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder);
if (updateResult <= 0) {
throw new RuntimeException("更新入库单主记录失败");
throw new BusinessException("更新入库单主记录失败");
}
try {
@ -163,7 +164,7 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
} catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
log.error("生成品质单时发生错误", e);
throw new RuntimeException("生成品质单时发生错误");
throw new BusinessException("生成品质单时发生错误");
}
return updateResult;

70
ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderMapper.xml

@ -327,6 +327,76 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
where sales_order_id = #{salesOrderId}
</update>
<update id="updateSysSalesOrderBySalesOrderCode" parameterType="SysSalesOrderVo">
update sys_sales_order
<trim prefix="SET" suffixOverrides=",">
<if test="salesOrderCode != null"> sales_order_code = #{salesOrderCode},</if>
<if test="salesOrderNumber != null">sales_order_number = #{salesOrderNumber},</if>
<if test="salesOrderType !=null">sales_order_type = #{salesOrderType},</if>
<if test="customerPurser !=null">customer_purser = #{customerPurser},</if>
<if test="enterpriseCode != null">enterprise_code = #{enterpriseCode},</if>
<if test="enterpriseName != null">enterprise_name =#{enterpriseName},</if>
<if test="materialSum != null">material_sum = #{materialSum},</if>
<if test="enterpriseSum != null">enterprise_sum = #{enterpriseSum},</if>
<if test="commonCurrency != null">common_currency = #{commonCurrency},</if>
<if test="noRmbPrice != null">noRmbPrice = #{noRmbPrice},</if>
<if test="noRmbSum != null">noRmbSum = #{noRmbSum},</if>
<if test="rmbPrice != null">rmbPrice = #{rmbPrice},</if>
<if test="rmbTaxSum != null">rmbTaxSum = #{rmbTaxSum},</if>
<if test="noUsdPrice != null">noUsdPrice = #{noUsdPrice},</if>
<if test="noUsdSum != null">noUsdSum = #{noUsdSum},</if>
<if test="usdPrice != null">usdPrice = #{usdPrice},</if>
<if test="usdTaxSum != null">usdTaxSum = #{usdTaxSum},</if>
<if test="confirmTax != null">confirm_tax = #{confirmTax},</if>
<if test="taxRate != null">tax_rate = #{taxRate},</if>
<if test="usdTax != null">usd_tax = #{usdTax},</if>
<if test="invoice != null">invoice = #{invoice},</if>
<if test="paymentTerms != null">payment_terms = #{paymentTerms},</if>
<if test="deliveryTime != null">delivery_time = #{deliveryTime},</if>
<if test="deliveryConditions != null">delivery_conditions = #{deliveryConditions},</if>
<if test="deliveryMethod != null">delivery_method = #{deliveryMethod},</if>
<if test="deliveryPhone != null">delivery_phone = #{deliveryPhone},</if>
<if test="deliveryAddress != null">delivery_address = #{deliveryAddress},</if>
<if test="customerDelivery != null">customer_delivery = #{customerDelivery},</if>
<if test="orderReceivingMode != null">order_receiving_mode = #{orderReceivingMode},</if>
<if test="orderReceivingTime != null">order_receiving_time =#{orderReceivingTime},</if>
<if test="customerContact != null">customer_contact = #{customerContact},</if>
<if test="contactEmail != null">contact_email = #{contactEmail},</if>
<if test="contactPost != null">contact_post = #{contactPost},</if>
<if test="contactNumber != null">contact_number = #{contactNumber},</if>
<if test="customerFax != null">csutomer_fax = #{customerFax},</if>
<if test="businessMembers != null">business_members = #{businessMembers},</if>
<if test="totalAmount !=null">total_amount = #{totalAmount},</if>
<if test="modificationTime != null">modification_time = #{modificationTime},</if>
<if test="tradeClause != null">trade_clause = #{tradeClause},</if>
<if test="standbyOne != null">standby_one = #{standbyOne},</if>
<if test="standbyTwo != null">standby_two = #{standbyTwo},</if>
<if test="fileUpload != null">file_upload = #{fileUpload},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="outBoundQuantity != null">un_bound_quantity = #{unBoundQuantity},</if>
<if test="unBoundQuantity != null">un_bound_quantity =#{unBoundQuantity},</if>
<if test="useStatus != null">use_status = #{useStatus},</if>
<if test="auditStatus != null">audit_status = #{auditStatus},</if>
<if test="makeStatus != null">make_status = #{makeStatus},</if>
<if test="deliveryStatus != null">delivery_status = #{deliveryStatus},</if>
<if test="closeStatus != null">close_status = #{closeStatus},</if>
<if test="instanceType != null">instance_type = #{instanceType},</if>
<if test="instanceId != null">instance_id = #{instanceId},</if>
<if test="submitInstanceId != null">submit_instance_id = #{submitInstanceId},</if>
<if test="cancelInstanceId != null">cancel_instance_id = #{cancelInstanceId},</if>
<if test="restoreInstanceId != null">restore_instance_id = #{restoreInstanceId},</if>
<if test="applyUser != null">apply_user = #{applyUser},</if>
<if test="applyTime != null">apply_time = #{applyTime},</if>
<if test="applyTitle != null">apply_title = #{applyTitle},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
update_info_time = now()
</trim>
where sales_order_code = #{salesOrderCode}
</update>
<delete id="deleteSysSalesOrderById" parameterType="Long">
update sys_sales_order set use_status = 1 where sales_order_id = #{salesOrderId}
</delete>

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

@ -199,7 +199,7 @@
var salesOrderTypeDatas = [[${@dict.getType('sys_order_type')}]];
var useStatusDatas = [[${@dict.getType('useStatus')}]];
var auditStatusDatas = [[${@dict.getType('auditStatus')}]];
var makeStatusDatas = [[${@dict.getType('sys_make_status')}]];
var makeStatusDatas = [[${@dict.getType('sys_erp_makeStatus')}]];
var deliveryStatusDatas = [[${@dict.getType('sys_delivery_status')}]];
var closeStatusDatas = [[${@dict.getType('sys_close_status')}]];
var confirmTaxDatas = [[${@dict.getType('sys_confirm_tax')}]];

6
ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/makeOutWarehouse.html

@ -11,7 +11,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">出库单号:</label>
<div class="col-sm-8">
<input name="outOrderCode" th:field="*{outOrderCode}" class="form-control" type="text" disabled>
<input name="outOrderCode" th:field="*{outOrderCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
@ -25,13 +25,13 @@
<div class="form-group">
<label class="col-sm-3 control-label">生产单号:</label>
<div class="col-sm-8">
<input name="makeNo" th:field="*{makeNo}" class="form-control" type="text" disabled>
<input name="makeNo" th:field="*{makeNo}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">申请人员:</label>
<div class="col-sm-8">
<input name="applyName" th:field="*{applyName}" class="form-control" type="text" disabled>
<input name="applyName" th:field="*{applyName}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">

Loading…
Cancel
Save