diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderMapper.java index 60c60b65..22c6af37 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderMapper.java +++ b/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); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseOutOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseOutOrderController.java index 23b92308..41453844 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseOutOrderController.java +++ b/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)); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderService.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderService.java index 7c4665dc..8aea63fe 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderService.java +++ b/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); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java index 8f654a63..7d97fdb8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java +++ b/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 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; + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java index b43423e5..ff706eae 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java +++ b/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; diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderMapper.xml index 67b49c24..47730301 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderMapper.xml @@ -327,6 +327,76 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where sales_order_id = #{salesOrderId} + + + update sys_sales_order + + sales_order_code = #{salesOrderCode}, + sales_order_number = #{salesOrderNumber}, + sales_order_type = #{salesOrderType}, + customer_purser = #{customerPurser}, + enterprise_code = #{enterpriseCode}, + enterprise_name =#{enterpriseName}, + material_sum = #{materialSum}, + enterprise_sum = #{enterpriseSum}, + common_currency = #{commonCurrency}, + noRmbPrice = #{noRmbPrice}, + noRmbSum = #{noRmbSum}, + rmbPrice = #{rmbPrice}, + rmbTaxSum = #{rmbTaxSum}, + noUsdPrice = #{noUsdPrice}, + noUsdSum = #{noUsdSum}, + usdPrice = #{usdPrice}, + usdTaxSum = #{usdTaxSum}, + confirm_tax = #{confirmTax}, + tax_rate = #{taxRate}, + usd_tax = #{usdTax}, + invoice = #{invoice}, + payment_terms = #{paymentTerms}, + delivery_time = #{deliveryTime}, + delivery_conditions = #{deliveryConditions}, + delivery_method = #{deliveryMethod}, + delivery_phone = #{deliveryPhone}, + delivery_address = #{deliveryAddress}, + customer_delivery = #{customerDelivery}, + order_receiving_mode = #{orderReceivingMode}, + order_receiving_time =#{orderReceivingTime}, + customer_contact = #{customerContact}, + contact_email = #{contactEmail}, + contact_post = #{contactPost}, + contact_number = #{contactNumber}, + csutomer_fax = #{customerFax}, + business_members = #{businessMembers}, + total_amount = #{totalAmount}, + modification_time = #{modificationTime}, + trade_clause = #{tradeClause}, + standby_one = #{standbyOne}, + standby_two = #{standbyTwo}, + file_upload = #{fileUpload}, + remark = #{remark}, + un_bound_quantity = #{unBoundQuantity}, + un_bound_quantity =#{unBoundQuantity}, + use_status = #{useStatus}, + audit_status = #{auditStatus}, + make_status = #{makeStatus}, + delivery_status = #{deliveryStatus}, + close_status = #{closeStatus}, + instance_type = #{instanceType}, + instance_id = #{instanceId}, + submit_instance_id = #{submitInstanceId}, + cancel_instance_id = #{cancelInstanceId}, + restore_instance_id = #{restoreInstanceId}, + apply_user = #{applyUser}, + apply_time = #{applyTime}, + apply_title = #{applyTitle}, + update_time = #{updateTime}, + update_info_time = now() + + where sales_order_code = #{salesOrderCode} + + + + update sys_sales_order set use_status = 1 where sales_order_id = #{salesOrderId} diff --git a/ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html b/ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html index 4c603bcf..c37577ff 100644 --- a/ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html +++ b/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')}]]; diff --git a/ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/makeOutWarehouse.html b/ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/makeOutWarehouse.html index 7161929f..fa6075be 100644 --- a/ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/makeOutWarehouse.html +++ b/ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/makeOutWarehouse.html @@ -11,7 +11,7 @@
- +
@@ -25,13 +25,13 @@
- +
- +