Browse Source

[feat] 仓库管理

新增仓库入库单:保存入库-采购单(仓库入库)后端接口方法
修改入库-采购单(仓库入库)前端页面:修改提交方法
修改入库-采购单(仓库入库)详情前端页面:修改提交方法
dev
liuxiaoxu 4 months ago
parent
commit
ccd0bf5b8b
  1. 4
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java
  2. 5
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java
  3. 75
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java
  4. 3
      ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storagePurchaseWarehouse.html
  5. 2
      ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storagePurchaseWarehouseDetail.html

4
ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java

@ -384,8 +384,8 @@ public class WarehouseStorageOrderController extends BaseController
@ResponseBody
public AjaxResult storagePurchaseWarehouseSave(@RequestBody WarehouseStorageOrder warehouseStorageOrder)
{
//暂时引用采购入库的保存方法
return toAjax(warehouseStorageOrderService.updateStoragePurchaseSave(warehouseStorageOrder));
return toAjax(warehouseStorageOrderService.updateStoragePurchaseWarehouseSave(warehouseStorageOrder));
}

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

@ -128,4 +128,9 @@ public interface IWarehouseStorageOrderService
* 通过生产入库单品质后生成入库单
* */
int insertWarehouseStorageOrderByMakeQualityOrder(QualityOrder tempQualityOrder, List<QualityOrderDetail> qualityOrderDetailList);
/**
* 修改保存入库-采购单(仓库入库)
*/
int updateStoragePurchaseWarehouseSave(WarehouseStorageOrder warehouseStorageOrder);
}

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

@ -432,6 +432,81 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
}
/**
* 修改保存入库-采购单(仓库入库)
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int updateStoragePurchaseWarehouseSave(WarehouseStorageOrder warehouseStorageOrder) {
String loginName = ShiroUtils.getLoginName();
//假设全部入库
warehouseStorageOrder.setWarehouseStorageStatus("4");
warehouseStorageOrder.setUpdateBy(loginName);
warehouseStorageOrder.setUpdateTime(new Date());
//记录一下入库时间
warehouseStorageOrder.setStorageTime(new Date());
List<WarehouseStorageOrderDetail> warehouseStorageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList();
if (StringUtils.isEmpty(warehouseStorageOrderDetailList)){
log.warn("入库单详情数据为空:{}",warehouseStorageOrderDetailList);
throw new BusinessException("入库单详情数据为空");
}
//入库数
Integer storageNum = 0;
// 检查storageNum是否含有null值
boolean hasThisStorageNumNull = warehouseStorageOrderDetailList.stream()
.anyMatch(item -> item.getStorageNum() == null);
if (hasThisStorageNumNull) {
throw new BusinessException("存在入库数为空,请检查!");
}
// 计算各个字段的总和
storageNum = warehouseStorageOrderDetailList.stream()
.mapToInt(WarehouseStorageOrderDetail::getStorageNum)
.sum();
//插入主表入库数量
warehouseStorageOrder.setStorageNum(storageNum);
//更新生产单数据
int updateMakeOrderResult = sysMakeOrderService.updateSysMakeOrderByWarehouseStorageOrder(warehouseStorageOrder, warehouseStorageOrderDetailList);
if (updateMakeOrderResult <= 0){
throw new BusinessException("更新生产订单失败,未影响任何行");
}
for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : warehouseStorageOrderDetailList) {
//更新入库单详情的数据
warehouseStorageOrderDetail.setUpdateBy(loginName);
warehouseStorageOrderDetail.setUpdateTime(new Date());
//更新已入库数
warehouseStorageOrderDetail.setHasStorageNum(warehouseStorageOrderDetail.getStorageNum());
int updateWarehouseStorageOrderDetailResult = storageOrderDetailMapper.updateWarehouseStorageOrderDetail(warehouseStorageOrderDetail);
if (updateWarehouseStorageOrderDetailResult <= 0){
throw new BusinessException("更新仓库入库单详情失败,未影响任何行");
}
}
//更新开发修改单数据
String relatedOrderCode = warehouseStorageOrder.getRelatedOrderCode();
ErpDevelopModifyorder erpDevelopModifyorder = developModifyorderMapper.selectErpDevelopModifyorderByCode(relatedOrderCode);
if (erpDevelopModifyorder != null){
erpDevelopModifyorder.setPurchaseStorageStatus("8");
developModifyorderMapper.updateErpDevelopModifyorder(erpDevelopModifyorder);
}
//更新入库单的数据
int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder);
if (updateResult <= 0){
log.warn("更新入库单失败,未影响任何行");
}
return updateResult;
}
/**
* 通用入库单详情保存接口
* */

3
ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storagePurchaseWarehouse.html

@ -114,6 +114,7 @@
var materialDataList = tableData.map(function (item) {
// 根据实际字段名调整
return {
"warehouseStorageDetailId":item.warehouseStorageDetailId,
"supplierCode": item.supplierCode,
"materialNo": item.materialNo,
"materialName": item.materialName,
@ -151,7 +152,7 @@
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/temporaryPurchaseWarehouse", jsonData);
$.operate.saveJson(prefix + "/storagePurchaseWarehouse", jsonData);
}
$("input[name='arrivedTime']").datetimepicker({

2
ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storagePurchaseWarehouseDetail.html

@ -151,7 +151,7 @@
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/temporaryPurchaseWarehouse", jsonData);
$.operate.saveJson(prefix + "/storagePurchaseWarehouseDetail", jsonData);
}
$("input[name='arrivedTime']").datetimepicker({

Loading…
Cancel
Save