Browse Source

修改:物料节点的研发总监审核通过后。新增库存物料信息添加方法addStockMaterial

dev
zhangsiqi 3 months ago
parent
commit
3e3b780a9b
  1. 8
      ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java
  2. 2
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialService.java
  3. 34
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java
  4. 73
      ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html

8
ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java

@ -18,6 +18,8 @@ import com.ruoyi.system.service.ISysErpMaterialSysTechnicalTeamService;
import com.ruoyi.system.service.ISysTechnicalTeamService; import com.ruoyi.system.service.ISysTechnicalTeamService;
import com.ruoyi.system.service.ISysRoleService; import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.warehouse.controller.WarehouseInventoryInquiryController;
import com.ruoyi.warehouse.service.IWarehouseInventoryInquiryService;
import org.activiti.engine.RuntimeService; import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService; import org.activiti.engine.TaskService;
import org.activiti.engine.runtime.ProcessInstance; import org.activiti.engine.runtime.ProcessInstance;
@ -71,6 +73,9 @@ public class ErpMaterialController extends BaseController
@Autowired @Autowired
private ISysUserService sysUserService; private ISysUserService sysUserService;
@Autowired
private IWarehouseInventoryInquiryService warehouseInventoryInquiryService;
@RequiresPermissions("erp:material:view") @RequiresPermissions("erp:material:view")
@GetMapping() @GetMapping()
public String material(ModelMap mmap) public String material(ModelMap mmap)
@ -202,8 +207,11 @@ public class ErpMaterialController extends BaseController
erpMaterialVo.setAuditStatus("1"); erpMaterialVo.setAuditStatus("1");
// 提交 // 提交
if("submit".equals(instanceType)){ if("submit".equals(instanceType)){
//物料审核通过后,填写通过后库存物料信息初始化,填写对应的信息
// 使用状态-是 // 使用状态-是
erpMaterialVo.setUseStatus("1"); erpMaterialVo.setUseStatus("1");
//审核通过后添加库存物料信息
erpMaterialService.addStockMaterial(erpMaterialVo);
} }
// 作废 // 作废
else if("cancel".equals(instanceType)){ else if("cancel".equals(instanceType)){

2
ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialService.java

@ -125,4 +125,6 @@ public interface IErpMaterialService
* @return * @return
*/ */
public ProcessInstance submitApply(ErpMaterial erpMaterial); public ProcessInstance submitApply(ErpMaterial erpMaterial);
Integer addStockMaterial(ErpMaterialVo erpMaterialVo);
} }

34
ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java

@ -20,6 +20,10 @@ import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.service.ISysAttachFileService; import com.ruoyi.system.service.ISysAttachFileService;
import com.ruoyi.system.service.ISysAttachService; import com.ruoyi.system.service.ISysAttachService;
import com.ruoyi.system.service.ISysRoleService; import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.warehouse.domain.WarehouseInventoryInquiry;
import com.ruoyi.warehouse.mapper.WarehouseInventoryInquiryMapper;
import com.ruoyi.warehouse.mapper.WarehouseStorageOrderDetailMapper;
import com.ruoyi.warehouse.mapper.WarehouseStorageOrderMapper;
import org.activiti.engine.TaskService; import org.activiti.engine.TaskService;
import org.activiti.engine.impl.persistence.entity.TaskEntityImpl; import org.activiti.engine.impl.persistence.entity.TaskEntityImpl;
import org.activiti.engine.runtime.ProcessInstance; import org.activiti.engine.runtime.ProcessInstance;
@ -43,6 +47,8 @@ public class ErpMaterialServiceImpl implements IErpMaterialService
{ {
@Autowired @Autowired
private ErpMaterialMapper erpMaterialMapper; private ErpMaterialMapper erpMaterialMapper;
@Autowired
private WarehouseInventoryInquiryMapper inventoryInquiryMapper;
@Autowired @Autowired
private ISysAttachService attachService; private ISysAttachService attachService;
@ -430,4 +436,32 @@ public class ErpMaterialServiceImpl implements IErpMaterialService
variables.put("authority",1); variables.put("authority",1);
} }
} }
/*审核通过添加库存物料信息*/
@Override
@Transactional(rollbackFor = Exception.class)
public Integer addStockMaterial(ErpMaterialVo erpMaterialVo) {
WarehouseInventoryInquiry warehouseInventoryInquiry = new WarehouseInventoryInquiry();
warehouseInventoryInquiry.setMaterialNo(erpMaterialVo.getMaterialNo());
warehouseInventoryInquiry.setMaterialName(erpMaterialVo.getMaterialName());
warehouseInventoryInquiry.setMaterialDescribe(erpMaterialVo.getDescribe());
warehouseInventoryInquiry.setMaterialBrand(erpMaterialVo.getBrand());
warehouseInventoryInquiry.setMaterialProcessMethod(erpMaterialVo.getProcessMethod());
warehouseInventoryInquiry.setMaterialUnit(erpMaterialVo.getUnit());
warehouseInventoryInquiry.setMaterialPhotourl(erpMaterialVo.getPhotoUrl());
warehouseInventoryInquiry.setMaterialType(erpMaterialVo.getMaterialType());
warehouseInventoryInquiry.setMaterialUseStatus(erpMaterialVo.getUseStatus());
warehouseInventoryInquiry.setWarehouseDept(erpMaterialVo.getWarehouseDept());
if(erpMaterialVo.getDescribe().contains(",")){
warehouseInventoryInquiry.setMaterialSpecification(erpMaterialVo.getDescribe().split(" ")[0]);
warehouseInventoryInquiry.setMaterialModel(erpMaterialVo.getDescribe().split(",")[1]);
}
String user = ShiroUtils.getLoginName();
warehouseInventoryInquiry.setCreateBy(user);
warehouseInventoryInquiry.setCreateTime(DateUtils.getNowDate());
warehouseInventoryInquiry.setUpdateBy(user);
warehouseInventoryInquiry.setUpdateTime(DateUtils.getNowDate());
return inventoryInquiryMapper.insertWarehouseInventoryInquiry(warehouseInventoryInquiry);
}
} }

73
ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html

@ -489,6 +489,79 @@
} }
} }
//获取仓库相关信息Select2
//根据仓库ID查询仓库名称
$(function() {
// 初始化时默认加载仓库ID列表
loadWarehouseCodes();
// 监听仓库ID下拉框的变化
$("input[name='deliveryTime']").datepicker({
language: 'zh-CN',
todayHighlight: true,
format: "yyyy-mm-dd",
autoClose: true,
});
});
$('#stockNo').on('change', function() {
var selectedWarehouseCode = $(this).val(); // 获取选中的仓库ID
if (selectedWarehouseCode) {
// 发起Ajax请求获取仓库名称
$.ajax({
type: 'GET',
url: ctx +'stock/stockInfo/getStockNameByWarehouseCode/' + selectedWarehouseCode,
dataType: 'json', // 假设返回的数据格式是JSON
success: function(data) {
console.log(data);
// 将获取到的仓库名称填充到输入框
if(data.data == null){
// 如果返回的数据有问题,可以给出提示或处理
$.modal.alertWarning('未能获取到仓库名称!');
}
$('input[name="stockName"]').val(data.data.stockName);
$('input[name="stockAddress"]').val(data.data.stockAddr);
$('input[name="stockContact"]').val(data.data.stockManager);
$('input[name="stockPhone"]').val(data.data.stockManagerPhone);
},
error: function(jqXHR, textStatus, errorThrown) {
console.error('Error:', textStatus, errorThrown);
$.modal.alertWarning('查询仓库名称时发生错误!');
}
});
} else {
// 如果没有选择仓库ID,清空仓库名称输入框
$('input[name="warehouseName"]').val('');
}
});
// 加载仓库Id列表函数
function loadWarehouseCodes() {
var url = ctx + 'stock/stockInfo/getAllWarehouseCode';
$.ajax({
type: 'GET', // 请求类型
url: url, // 后端接口URL
dataType: 'json', // 预期服务器返回的数据类型
success: function(data) {
if (data && Array.isArray(data)) {
var selectElement = $('#stockNo'); // 获取仓库编号下拉框元素
// 清空下拉框现有选项
selectElement.empty();
// 添加默认选项(如果需要)编辑时不需要添加默认选项
// selectElement.append('<option value="">所有</option>');
// 遍历返回的数据,添加为下拉框的选项
$.each(data, function(index, item) {
// 仓库ID
selectElement.append('<option value="' + item.stockNO + '">' + item.stockNO + '</option>');
});
// $('#warehouseCode').val(stockNO);
} else {
$.modal.errMsg("数据为空");
}
}
});
}
</script> </script>
</body> </body>
</html> </html>
Loading…
Cancel
Save