MES:销售订单导入功能
WMS:库存导出功能
master
xs 5 days ago
parent 9fcec467b9
commit d961e476ef

@ -273,6 +273,7 @@ public class MesConstants {
public static final String MES_SALE_ORDER_CLASSFICATION_ERP= "1"; //ERP同步销售订单
public static final String MES_SALE_ORDER_CLASSFICATION_VIRTUAL= "2"; //虚拟销售订单
public static final String MES_SALE_ORDER_CLASSFICATION_MES= "3"; //MES创建
/**
* 1 2 3

@ -376,6 +376,19 @@ public class Seq {
// 采购申请单任务编号的记录标识
public static final String mesPurchaseApplyCode = "PA";
// 销售订单记录序列类型
public static final String mesSaleOrderSeqType = "MESSALEORDER";
// 销售订单记录接口序列数
private static AtomicInteger mesSaleOrderSeq = new AtomicInteger(1);
// 销售订单记录标识
public static final String mesSaleOrderSeqCode = "XSDD";
/**
*
*
@ -521,4 +534,31 @@ public class Seq {
return result;
}
/**
* 16 yyMMddHHmmss + + 3
*
* @return
*/
public static String getNewId(String type,String code) {
AtomicInteger atomicInt = commSeq;
if (productOutstockSeqType.equals(type)) {
atomicInt = productOutstockSeq;
}
return getNewId(atomicInt, 4, code);
}
/**
* +yyMMdd + length
*
* @param atomicInt
* @param length
* @return
*/
public static String getNewId(AtomicInteger atomicInt, int length, String code) {
String result = code;
result += DateUtils.dateTime();
result += getSeq(atomicInt, length);
return result;
}
}

@ -7,9 +7,11 @@ import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.domain.MesPurchaseRequisitionTemplate;
import com.hw.mes.domain.MesSaleOrder;
import com.hw.mes.service.IMesBasePalletInfoService;
import com.hw.mes.service.IMesImportService;
import com.hw.mes.service.IMesPurchaseApplyService;
import com.hw.mes.service.IMesSaleOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -34,6 +36,9 @@ public class MesImportController extends BaseController {
@Autowired
private IMesPurchaseApplyService mesPurchaseApplyService;
@Autowired
private IMesSaleOrderService mesSaleOrderService;
/**
* excel
@ -97,4 +102,20 @@ public class MesImportController extends BaseController {
return success(message);
}
/**
* excel
*/
@Log(title = "销售订单", businessType = BusinessType.IMPORT)
@PostMapping(("/importSaleOrderData"))
public AjaxResult importSaleOrderData(MultipartFile file, boolean updateSupport) throws Exception
{
ExcelUtil<MesSaleOrder> util = new ExcelUtil<>(MesSaleOrder.class);
List<MesSaleOrder> mesSaleOrderList = util.importExcel(file.getInputStream());
System.out.println(mesSaleOrderList.toString());
return success(mesSaleOrderService.importSaleOrderData(mesSaleOrderList));
}
}

@ -76,7 +76,7 @@ public class MesSaleOrder extends BaseEntity {
/**
* ;FMaterialId.FNumber
*/
@Excel(name = "物料编码;对应FMaterialId.FNumber")
@Excel(name = "物料编码")
private String materialCode;
/**
@ -94,7 +94,7 @@ public class MesSaleOrder extends BaseEntity {
/**
* ;FQty
*/
@Excel(name = "订单计划数量;对应FQty")
@Excel(name = "订单计划数量")
private BigDecimal orderAmount;
/**
@ -174,6 +174,8 @@ public class MesSaleOrder extends BaseEntity {
@Excel(name = "是否标识1-是0-否")
private String isFlag;
private String tondBase;
/**
*
*/
@ -205,6 +207,7 @@ public class MesSaleOrder extends BaseEntity {
private String overtimeFlag;
@Excel(name = "项目名称")
private String projectName;//项目名称
@ -424,6 +427,14 @@ public class MesSaleOrder extends BaseEntity {
return isFlag;
}
public String getTondBase() {
return tondBase;
}
public void setTondBase(String tondBase) {
this.tondBase = tondBase;
}
public String getMaterialSpec() {
return materialSpec;
}

@ -126,4 +126,11 @@ public interface IMesSaleOrderService
*
*/
public void saleOrderOverTimeAlarm();
/**
*
* @param mesSaleOrderList
* @return
*/
public int importSaleOrderData(List<MesSaleOrder> mesSaleOrderList);
}

@ -13,6 +13,7 @@ import com.hw.common.core.constant.SystemConstants;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
import com.hw.common.core.utils.uuid.Seq;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesBaseMaterialInfo;
@ -21,6 +22,7 @@ import com.hw.mes.api.domain.MesSaleOrderRelate;
import com.hw.mes.api.domain.vo.MesBaseBarcodeInfoTransferVo;
import com.hw.mes.api.domain.vo.MesSaleOrderTransferVo;
import com.hw.mes.domain.MesMaterialBom;
import com.hw.mes.domain.MesProjectInfo;
import com.hw.mes.domain.MesSaleOrderMaterial;
import com.hw.mes.mapper.*;
import com.hw.system.api.RemoteSysCommonService;
@ -59,6 +61,9 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService {
@Autowired
private MesSaleOrderMaterialMapper mesSaleOrderMaterialMapper;
@Autowired
private MesProjectInfoMapper mesProjectInfoMapper;
@Resource
private RemoteSysCommonService remoteSysCommonService;
@ -390,4 +395,53 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService {
sysPointRouter.setCreateTime(currentDate);
return sysPointRouter;
}
/**
*
* @param mesSaleOrderList
* @return
*/
@Override
public int importSaleOrderData(List<MesSaleOrder> mesSaleOrderList) {
Date currentDate = new Date();
String nickName = SecurityUtils.getLoginUser().getNickname();
for (MesSaleOrder mesSaleOrder : mesSaleOrderList) {
String materialCode = mesSaleOrder.getMaterialCode();
if(StringUtils.isEmpty(materialCode)){
throw new ServiceException("物料编码不能为空");
}
BigDecimal orderAmount = mesSaleOrder.getOrderAmount();
if(orderAmount==null || orderAmount.compareTo(BigDecimal.ZERO)<=0){
throw new ServiceException("订单数量需大于0");
}
MesBaseMaterialInfo mesBaseMaterialInfo = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByMaterialCode(materialCode);
String projectName = mesSaleOrder.getProjectName();
if(StringUtils.isNotEmpty(projectName)){
MesProjectInfo queryProjectInfo = new MesProjectInfo();
queryProjectInfo.setProjectName(projectName);
List<MesProjectInfo> mesProjectInfoList = mesProjectInfoMapper.selectMesProjectInfoList(queryProjectInfo);
if(mesProjectInfoList!=null && !mesProjectInfoList.isEmpty()){
MesProjectInfo mesProjectInfo = mesProjectInfoList.get(0);
mesSaleOrder.setTondBase(String.valueOf(mesProjectInfo.getErpId()));
}
}
String saleOrderCode = Seq.getNewId(Seq.mesSaleOrderSeqType,Seq.mesSaleOrderSeqCode);
mesSaleOrder.setSaleorderCode(saleOrderCode);
mesSaleOrder.setMaterialId(mesBaseMaterialInfo.getErpId());
mesSaleOrder.setCreateTime(currentDate);
// mesSaleOrder.setErpModifyDate(currentDate);
mesSaleOrder.setCreateBy(nickName);
mesSaleOrder.setSaleOrderClassfication(MesConstants.MES_SALE_ORDER_CLASSFICATION_MES);
mesSaleOrderMapper.insertMesSaleOrder(mesSaleOrder);
}
return 1;
}
}

@ -31,6 +31,7 @@
<result property="completeDate" column="complete_date"/>
<result property="saleOrderClassfication" column="sale_order_classfication"/>
<result property="isFlag" column="is_flag"/>
<result property="tondBase" column="tond_base"/>
<result property="remark" column="remark"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
@ -139,6 +140,7 @@
<if test="endDate != null">end_date,</if>
<if test="completeDate != null">complete_date,</if>
<if test="isFlag != null and isFlag != ''">is_flag,</if>
<if test="tondBase != null and tondBase != ''">tond_base,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
@ -169,6 +171,7 @@
<if test="endDate != null">#{endDate},</if>
<if test="completeDate != null">#{completeDate},</if>
<if test="isFlag != null and isFlag != ''">#{isFlag},</if>
<if test="tondBase != null and tondBase != ''">#{tondBase},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
@ -256,7 +259,7 @@
mso.sale_order_classfication,
mpi.project_name
from mes_sale_order mso left join mes_base_material_info mbmi on
((mso.material_id = mbmi.erp_id and mso.sale_order_classfication='1') or (mso.material_id = mbmi.material_id and mso.sale_order_classfication='2'))
((mso.material_id = mbmi.erp_id and (mso.sale_order_classfication='1' or mso.sale_order_classfication='3')) or (mso.material_id = mbmi.material_id and mso.sale_order_classfication='2'))
left join mes_project_info mpi on mso.tond_base=mpi.erp_id
<where>
<if test="saleorderCode != null and saleorderCode != ''">and mso.saleorder_code like concat('%', #{saleorderCode},
@ -281,7 +284,7 @@
<if test='overtimeFlag != null and overtimeFlag != "" and overtimeFlag == "0"'>and mso.plan_delivery_date is not null and mso.plan_delivery_date >= now() </if>
</where>
order by mso.erp_modify_date desc
order by mso.create_time desc
</select>

@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson2.JSONObject;
import com.hw.common.core.constant.WmsConstants;
import com.hw.wms.domain.WmsBaseWarehouse;
import com.hw.wms.domain.vo.WmsStockTotalExportVo;
import com.hw.wms.domain.vo.WmsStockTotalTransferVo;
import com.hw.wms.domain.vo.WmsStockTransferVo;
import com.hw.wms.service.IWmsBaseWarehouseService;
@ -73,9 +74,9 @@ public class WmsStockTotalController extends BaseController
@PostMapping("/export")
public void export(HttpServletResponse response, WmsStockTotal wmsStockTotal)
{
List<WmsStockTotal> list = wmsStockTotalService.selectWmsStockTotalList(wmsStockTotal);
ExcelUtil<WmsStockTotal> util = new ExcelUtil<WmsStockTotal>(WmsStockTotal.class);
util.exportExcel(response, list, "原材料/成品库存数据");
List<WmsStockTotalExportVo> list = wmsStockTotalService.selectWmsStockTotalExportList(wmsStockTotal);
ExcelUtil<WmsStockTotalExportVo> util = new ExcelUtil<WmsStockTotalExportVo>(WmsStockTotalExportVo.class);
util.exportExcel(response, list, "库存数据");
}
/**

@ -0,0 +1,201 @@
package com.hw.wms.domain.vo;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
import java.math.BigDecimal;
/**
* wms_stock_total
*
* @author xins
* @date 2025-01-14
*/
public class WmsStockTotalExportVo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
@Excel(name = "物料编码")
private String materialCode;
/**
*
*/
@Excel(name = "物料名称")
private String materialName;
/**
*
*/
@Excel(name = "规格型号")
private String materialSpec;
/**
*
*/
@Excel(name = "仓库名称")
private String warehouseName;
/**
* ;
*/
@Excel(name = "库存量(主单位)")
private BigDecimal totalAmount;
@Excel(name = "库存主单位")
private String unitName;
@Excel(name = "可用量(主单位)")
private BigDecimal availableAmount;
@Excel(name = "库存状态")
private String stockStatus = "可用";
@Excel(name = "货主类型")
private String ownerType = "业务组织";
@Excel(name = "货主编码")
private String ownerCode = "100";
@Excel(name = "货主名称")
private String ownerName="江苏京源环保股份有限公司";
@Excel(name = "保管者类型")
private String preserverType = "业务组织";
@Excel(name = "保管者编码")
private String preserverCode="100";
@Excel(name = "保管者名称")
private String preserverName="江苏京源环保股份有限公司";
@Excel(name = "库存组织")
private String stockOrg="江苏京源环保股份有限公司";
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getMaterialSpec() {
return materialSpec;
}
public void setMaterialSpec(String materialSpec) {
this.materialSpec = materialSpec;
}
public String getWarehouseName() {
return warehouseName;
}
public void setWarehouseName(String warehouseName) {
this.warehouseName = warehouseName;
}
public BigDecimal getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(BigDecimal totalAmount) {
this.totalAmount = totalAmount;
}
public String getUnitName() {
return unitName;
}
public void setUnitName(String unitName) {
this.unitName = unitName;
}
public BigDecimal getAvailableAmount() {
return availableAmount == null ? totalAmount : availableAmount;
}
public void setAvailableAmount(BigDecimal availableAmount) {
this.availableAmount = availableAmount;
}
public String getStockStatus() {
return stockStatus;
}
public void setStockStatus(String stockStatus) {
this.stockStatus = stockStatus;
}
public String getOwnerType() {
return ownerType;
}
public void setOwnerType(String ownerType) {
this.ownerType = ownerType;
}
public String getOwnerCode() {
return ownerCode;
}
public void setOwnerCode(String ownerCode) {
this.ownerCode = ownerCode;
}
public String getOwnerName() {
return ownerName;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
public String getPreserverType() {
return preserverType;
}
public void setPreserverType(String preserverType) {
this.preserverType = preserverType;
}
public String getPreserverCode() {
return preserverCode;
}
public void setPreserverCode(String preserverCode) {
this.preserverCode = preserverCode;
}
public String getPreserverName() {
return preserverName;
}
public void setPreserverName(String preserverName) {
this.preserverName = preserverName;
}
public String getStockOrg() {
return stockOrg;
}
public void setStockOrg(String stockOrg) {
this.stockOrg = stockOrg;
}
}

@ -3,6 +3,7 @@ package com.hw.wms.mapper;
import java.util.List;
import com.hw.wms.domain.WmsStockTotal;
import com.hw.wms.domain.vo.WmsStockTotalExportVo;
/**
* Mapper
@ -109,4 +110,12 @@ public interface WmsStockTotalMapper {
*/
public List<WmsStockTotal> selectStockTotalListGroupByMaterial(WmsStockTotal wmsStockTotal);
/**
*
* @param wmsStockTotal
* @return
*/
public List<WmsStockTotalExportVo> selectWmsStockTotalExportList(WmsStockTotal wmsStockTotal);
}

@ -1,14 +1,12 @@
package com.hw.wms.service;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson2.JSONObject;
import com.hw.wms.domain.WmsStockTotal;
import com.hw.wms.domain.vo.WmsStockTotalExportVo;
import com.hw.wms.domain.vo.WmsStockTotalTransferVo;
import com.hw.wms.domain.vo.WmsStockTransferVo;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
@ -119,4 +117,12 @@ public interface IWmsStockTotalService
* @param wmsStockTotalTransferVo
*/
public int transferProductStockTotal(WmsStockTotalTransferVo wmsStockTotalTransferVo);
/**
* 4
*
* @param wmsStockTotal
* @return
*/
public List<WmsStockTotalExportVo> selectWmsStockTotalExportList(WmsStockTotal wmsStockTotal);
}

@ -15,15 +15,12 @@ import com.hw.common.core.utils.StringUtils;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.RemoteMesService;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesBaseMaterialInfo;
import com.hw.mes.api.domain.MesBaseStationInfo;
import com.hw.mes.api.domain.MesSaleOrderRelate;
import com.hw.mes.api.domain.vo.MesBaseBarcodeInfoTransferVo;
import com.hw.mes.api.domain.vo.MesSaleOrderTransferVo;
import com.hw.wms.config.WmsConfig;
import com.hw.wms.domain.WmsBaseLocation;
import com.hw.wms.domain.WmsProductStock;
import com.hw.wms.domain.WmsRawStock;
import com.hw.wms.domain.*;
import com.hw.wms.domain.vo.WmsStockTotalExportVo;
import com.hw.wms.domain.vo.WmsStockTotalTransferVo;
import com.hw.wms.domain.vo.WmsStockTransferVo;
import com.hw.wms.mapper.WmsBaseLocationMapper;
@ -32,7 +29,6 @@ import com.hw.wms.mapper.WmsRawStockMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.wms.mapper.WmsStockTotalMapper;
import com.hw.wms.domain.WmsStockTotal;
import com.hw.wms.service.IWmsStockTotalService;
import org.springframework.transaction.annotation.Transactional;
@ -518,4 +514,16 @@ public class WmsStockTotalServiceImpl implements IWmsStockTotalService {
}
/**
* 4
*
* @param wmsStockTotal
* @return
*/
@Override
public List<WmsStockTotalExportVo> selectWmsStockTotalExportList(WmsStockTotal wmsStockTotal) {
return wmsStockTotalMapper.selectWmsStockTotalExportList(wmsStockTotal);
}
}

@ -60,6 +60,20 @@
</resultMap>
<resultMap type="com.hw.wms.domain.vo.WmsStockTotalExportVo" id="WmsStockTotalExportResult">
<result property="warehouseName" column="warehouse_name"/>
<result property="totalAmount" column="total_amount"/>
<result property="availableAmount" column="available_amount"/>
<result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name"/>
<result property="materialSpec" column="material_spec"/>
<result property="unitName" column="unit_name"/>
</resultMap>
<sql id="selectWmsStockTotalVo">
select wst.stock_total_id,
wst.warehouse_id,
@ -378,4 +392,23 @@
</select>
<select id="selectWmsStockTotalExportList" parameterType="WmsStockTotal" resultMap="WmsStockTotalExportResult">
select wst.warehouse_id,wbw.warehouse_name,wst.material_id,mbmi2.material_code,mbmi2.material_name,mbmi2.material_spec,
sum(wst.total_amount) total_amount,sum(wst.total_amount) available_amount,
(select mbui.unit_name from mes_base_unit_info mbui
where exists (select 1 from mes_base_material_info mbmi where mbui.erp_id=mbmi.material_unit_id and mbmi.material_id=wst.material_id)) unit_name
from wms_stock_total wst
left join wms_base_warehouse wbw on wst.warehouse_id =wbw.warehouse_id
left join mes_base_material_info mbmi2 on mbmi2.material_id =wst.material_id
where wst.total_amount > 0
group by wst.warehouse_id,wst.material_id order by wst.warehouse_id
</select>
</mapper>

@ -139,7 +139,17 @@
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar-->
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-upload2"
size="mini"
@click="handleImport"
v-hasPermi="['mes:saleOrder:import']"
>销售订单导入
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
@ -413,6 +423,36 @@
<order-binds ref="orderBindsRef" :defineData="orderBindsData"
v-if="orderBindDialogVisible"></order-binds>
</el-dialog>
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<span>仅允许导入xlsxlsx格式文件</span>
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" :loading="submitLoading" @click="submitFileForm"> </el-button>
<el-button @click="upload.open = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
@ -421,6 +461,7 @@ import { listSaleOrder, getSaleOrder, delSaleOrder, addSaleOrder, updateSaleOrde
import saleOrderRelates from "@/views/mes/saleOrder/saleOrderRelates.vue";
import orderBinds from "@/views/mes/saleOrder/orderBinds.vue";
import {runJob} from "@/api/monitor/job";
import {getToken} from "@/utils/auth";
export default {
name: "SaleOrder",
@ -526,6 +567,21 @@ export default {
orderBindDialogVisible: false,
orderBindsData: {},
upload: {
//
open: false,
//
title: "",
//
isUploading: false,
//
updateSupport: 0,
//
headers: {Authorization: "Bearer " + getToken()},
//
url: process.env.VUE_APP_BASE_API + "/mes/import/importSaleOrderData"
},
};
},
created() {
@ -699,7 +755,37 @@ export default {
this.download('mes/saleOrder/exportSaleOrderMaterials', {
...this.queryParams
}, `物料情况使用_${new Date().getTime()}.xlsx`)
}
},
/** 导入按钮操作 */
handleImport() {
this.upload.title = "提资单导入";
this.upload.open = true;
this.submitLoading = false;
},
//
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
//
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", {dangerouslyUseHTMLString: true});
this.getList();
this.submitLoading = false;
},
//
submitFileForm() {
this.submitLoading = true;
this.$refs.upload.submit();
},
}
};

@ -106,6 +106,19 @@
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['dms:shutDown:export']"
>导出</el-button>
</el-col>
</el-row>
<el-table v-loading="loading" :data="stocktotalList" @selection-change="handleSelectionChange">
<!--el-table-column type="selection" width="55" align="center"/-->
<!-- <el-table-column label="总库存ID" align="center" prop="stockTotalId"/>-->

Loading…
Cancel
Save