成本中心,盘点审核

This commit is contained in:
王帅 2025-05-13 15:26:39 +08:00
parent 4df4664fac
commit bfbfbbbdc3
9 changed files with 127 additions and 13 deletions

View File

@ -5763,7 +5763,7 @@ public class ToSAPServiceImpl {
return null; return null;
} }
public String qtcrNoInvoiceForCheckPlan(List<Map<String, Object>> srPk, String qtc, String user, String commitDate, String opCode) { public String qtcrNoInvoiceForCheckPlan(List<Map<String, Object>> srPk, String qtc, String user, String commitDate, String opCode, String costName) {
String rcode; String rcode;
String undoId = ""; String undoId = "";
String rmsg = null; String rmsg = null;
@ -5794,14 +5794,14 @@ public class ToSAPServiceImpl {
body.put("ITEM", itemArray); body.put("ITEM", itemArray);
body.put("ITEMID", uniqueID); body.put("ITEMID", uniqueID);
// SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd");
// SimpleDateFormat outputFormat = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat outputFormat = new SimpleDateFormat("yyyyMMdd");
// Date date = inputFormat.parse(commitDate); Date date = inputFormat.parse(commitDate);
// String outputDate = outputFormat.format(date); String outputDate = outputFormat.format(date);
//过账日期 //过账日期
body.put("BUDAT", TimeStampUtil.getCurrentTime("yyyyMMdd")); body.put("BUDAT", outputDate);
//凭证日期 //凭证日期
body.put("BLDAT", TimeStampUtil.getCurrentTime("yyyyMMdd")); body.put("BLDAT", outputDate);
//凭证抬头文本 //凭证抬头文本
body.put("BKTXT", uniqueID); body.put("BKTXT", uniqueID);
//用户名 //用户名
@ -5823,13 +5823,13 @@ public class ToSAPServiceImpl {
// WERKS 发货工厂 // WERKS 发货工厂
item.put("WERKS", auditBox.get("ERPFACTORY")); item.put("WERKS", auditBox.get("ERPFACTORY"));
// LGORT 发货库存地点 // LGORT 发货库存地点
item.put("LGORT", auditBox.get("SYSLOCATION")); item.put("LGORT", auditBox.get("ERPLOCATION"));
//MENGE 数量 //MENGE 数量
item.put("MENGE", auditBox.get("MATERIALQUANTITY")); item.put("MENGE", auditBox.get("MATERIALQUANTITY"));
//MENGE 单位 //MENGE 单位
item.put("MEINS", auditBox.get("UNIT")); item.put("MEINS", auditBox.get("UNIT"));
//KOSTL 成本中心 //KOSTL 成本中心
item.put("KOSTL", auditBox.get("CostCenterName")); item.put("KOSTL", costName);
itemArray.add(item); itemArray.add(item);

View File

@ -109,6 +109,7 @@ public class CheckMarkController {
String checkPlanName = javaObject.getCheckPlanName();//测试名 String checkPlanName = javaObject.getCheckPlanName();//测试名
String user=javaObject.getUser(); String user=javaObject.getUser();
String commitDate=javaObject.getCommitDate(); String commitDate=javaObject.getCommitDate();
String costName=javaObject.getCostName();
String opCode = javaObject.getOpCode(); String opCode = javaObject.getOpCode();
if(StringUtils.isEmpty(commitDate)) if(StringUtils.isEmpty(commitDate))
{ {
@ -122,8 +123,8 @@ public class CheckMarkController {
Map<String, Object> bindMap = new HashMap<String, Object>(); Map<String, Object> bindMap = new HashMap<String, Object>();
bindMap.put("PLANDATE",planDate); bindMap.put("PLANDATE",planDate);
bindMap.put("CHECKPLANNAME",checkPlanName); bindMap.put("CHECKPLANNAME",checkPlanName);
//盘点计划有实物没有做其他出库.zd.2024.8.30 //盘点计划有实物没有做其他出库.zd.2024.8.30
// 获取盘亏的ERPLOCATION // 获取盘亏的ERPLOCATION
String sql_erp = " SELECT DISTINCT ERPLOCATION FROM (\r\n" String sql_erp = " SELECT DISTINCT ERPLOCATION FROM (\r\n"
@ -155,7 +156,7 @@ public class CheckMarkController {
if(sr_pk.size()>0) if(sr_pk.size()>0)
{ {
//调用SAP接口 //调用SAP接口
billCode=toSAPServiceImpl.qtcrNoInvoiceForCheckPlan(sr_pk, "qtc", user, commitDate,opCode); billCode=toSAPServiceImpl.qtcrNoInvoiceForCheckPlan(sr_pk, "qtc", user, commitDate,opCode,costName);
//更新盘点计划状态 //更新盘点计划状态
String sql = "UPDATE CHECKPLAN c SET CHECKPLANSTATE = 'Approved' WHERE PLANDATE = :PLANDATE AND CHECKPLANNAME = :CHECKPLANNAME AND ERPLOCATION=:ERPLOCATION"; String sql = "UPDATE CHECKPLAN c SET CHECKPLANSTATE = 'Approved' WHERE PLANDATE = :PLANDATE AND CHECKPLANNAME = :CHECKPLANNAME AND ERPLOCATION=:ERPLOCATION";
IDMFrameServiceProxy.getSqlTemplate().update(sql, bindMap); IDMFrameServiceProxy.getSqlTemplate().update(sql, bindMap);
@ -213,7 +214,7 @@ public class CheckMarkController {
List<Map<String, Object>> sr_pk = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql_py, bindMap); List<Map<String, Object>> sr_pk = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql_py, bindMap);
if (sr_pk.size() > 0) { if (sr_pk.size() > 0) {
// 调用SAP接口 // 调用SAP接口
billCode = toSAPServiceImpl.qtcrNoInvoiceForCheckPlan(sr_pk, "qtr", user, commitDate,opCode); billCode = toSAPServiceImpl.qtcrNoInvoiceForCheckPlan(sr_pk, "qtr", user, commitDate,opCode,costName);
// 更新盘点计划状态 // 更新盘点计划状态
String sql = "UPDATE CHECKRECORD c SET CHECKPLANSTATE = 'Approved' WHERE PLANDATE = :PLANDATE AND CHECKPLANNAME = :CHECKPLANNAME AND ERPLOCATION=:ERPLOCATION"; String sql = "UPDATE CHECKRECORD c SET CHECKPLANSTATE = 'Approved' WHERE PLANDATE = :PLANDATE AND CHECKPLANNAME = :CHECKPLANNAME AND ERPLOCATION=:ERPLOCATION";
IDMFrameServiceProxy.getSqlTemplate().update(sql, bindMap); IDMFrameServiceProxy.getSqlTemplate().update(sql, bindMap);

View File

@ -0,0 +1,35 @@
package com.cim.idm.controller;
import com.cim.idm.model.CostCenter;
import com.cim.idm.response.BaseResponse;
import com.cim.idm.response.RespGenerator;
import com.cim.idm.service.CostCenterService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/CostCenter")
@Slf4j
@Api(tags = "成本中心")
public class CostCenterController {
@Autowired
private CostCenterService costCenterService;
/**
* 获取成本中心
* @return
*/
@RequestMapping(value = "/getCostCenter", method = RequestMethod.GET)
public BaseResponse<Object> getCostCenter() {
List<CostCenter> costCenters = costCenterService.getCostCenter();
return RespGenerator.returnOK(costCenters);
}
}

View File

@ -0,0 +1,14 @@
package com.cim.idm.dao;
import com.cim.idm.model.CostCenter;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
@Mapper
public interface CostCenterDao {
List<CostCenter> getCostCenter();
}

View File

@ -32,6 +32,7 @@ public class CheckPlan {
private int pageSize; private int pageSize;
private String commitDate; private String commitDate;
private String costName;
private String opCode; private String opCode;
} }

View File

@ -0,0 +1,23 @@
package com.cim.idm.model;
import lombok.Data;
/**
* @Description
* @Author admin
* @Date 2025/5/13 11:40
*/
@Data
public class CostCenter {
private String id;
// 编码
private String costCode;
// 名称
private String costName;
// 组织
private String erpFactory;
// 部门
private String department;
// 事业部
private String division;
}

View File

@ -0,0 +1,9 @@
package com.cim.idm.service;
import com.cim.idm.model.CostCenter;
import java.util.List;
public interface CostCenterService {
List<CostCenter> getCostCenter();
}

View File

@ -0,0 +1,22 @@
package com.cim.idm.service.Impl;
import com.cim.idm.dao.CostCenterDao;
import com.cim.idm.model.CostCenter;
import com.cim.idm.service.CostCenterService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("CostCenterService")
@Slf4j
public class CostCenterServiceImpl implements CostCenterService {
@Autowired
private CostCenterDao costCenterDao;
@Override
public List<CostCenter> getCostCenter() {
return costCenterDao.getCostCenter();
}
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cim.idm.dao.CostCenterDao">
<select id="getCostCenter" resultType="com.cim.idm.model.CostCenter">
select id, cost_code costCode, cost_name costName, erp_factory erpFactory, department, division
from cost_center
</select>
</mapper>