heshaofeng
2025-11-06 bfa8a6b595295a3c444b6cfbb40278f42b3178e7
前端页面
已添加8个文件
已修改13个文件
900 ■■■■ 文件已修改
项目代码/WIDESEA_WMSClient/src/extension/inbound/Dt_MaterielToMes.js 253 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WIDESEA_WMSClient/src/views/inbound/Dt_MaterielToMes.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1091.29919/CodeChunks.db 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1091.29919/CodeChunks.db-shm 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1091.29919/CodeChunks.db-wal 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1091.29919/SemanticSymbols.db 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1091.29919/SemanticSymbols.db-shm 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1091.29919/SemanticSymbols.db-wal 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/copilot-chat/13d2ebf8/sessions/5c08ea60-efea-4683-8780-e289f0bee8d0 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_AllocateService/AllocateService.cs 338 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_AllocateService/WIDESEA_AllocateService.csproj 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Common/AllocateEnum/BusinessTypeEnum.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Core/CodeConfigEnum/RuleCodeEnum.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_DTO/Allocate/AllocateDto.cs 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_IAllocateService/IAllocateService.cs 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Allocate/Dt_ AllocateOrder.cs 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Allocate/Dt_AllocateOrderDetail.cs 104 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Inbound/Dt_InboundOrder.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_OutboundOrder.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Allocate/AllocateOrderController.cs 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/inbound/Dt_MaterielToMes.js
@@ -14,9 +14,9 @@
    modelBody: '',
    modelFooter: ''
  },
  tableAction: '', //指定某张表的权限(这里填写表名,默认不用填写)
  tableAction: '',
  buttons: { view: [{
 name: '生成二维码',
  name: '生成二维码',
  type: 'success',
  value: '生成二维码',
  onClick: async function () {
@@ -31,43 +31,18 @@
      return;
    }
    // 2. èŽ·å–å•æ®ç¼–å·
    const newMaterialBarCode = selectedRows[0].newMaterialBarCode;
    if (!newMaterialBarCode) {
      ElMessage.error('选中的数据中未找到单据编号');
    // 2. èŽ·å–æ ¸å¿ƒç‰©æ–™å­—æ®µï¼ˆæ–™å·ã€å“åã€è§„æ ¼ç­‰ï¼‰
    const { materielCode, materialName, specification, lotNo, batchNo, date } = selectedRows[0];
    if (!materielCode) {
      ElMessage.error('选中数据缺少料号信息');
      return;
    }
    // 3. èŽ·å–å•æ®æ˜Žç»†æ•°æ®ï¼ˆæ–°å¢žï¼šé€šè¿‡å•æ®ç¼–å·èŽ·å–QtyTrans、MaterialCode、MaterialName)
    // let detailList  = [];
    // const loading = ElLoading.service({ text: '获取单据明细中...' });
    // try {
    //   const res = await http.post('/api/DocumentDetail/details', { transNo: transNo });
    //   // æ ¡éªŒè¿”回格式(必须是数组且至少有一条数据)
    //   if (!res.status || !Array.isArray(res.data) || res.data.length === 0) {
    //     throw new Error('未查询到单据明细数据');
    //   }
    //   detailList = res.data;
    //   // æ ¡éªŒæ¯æ¡æ˜Žç»†çš„必填字段
    //   detailList.forEach((item, index) => {
    //     if (!item.qtyTrans || !item.materialCode || !item.materialName) {
    //       throw new Error(`第${index + 1}条明细数据不完整`);
    //     }
    //   });
    // } catch (err) {
    //   ElMessage.error(err.message || '获取单据明细失败');
    //   loading.close();
    //   return;
    // } finally {
    //   loading.close();
    // }
    // 4. ç”ŸæˆäºŒç»´ç 
    // 3. ç”ŸæˆäºŒç»´ç ï¼ˆå†…容为料号,可根据需求拼接更多信息)
    let qrCodeUrl = '';
    try {
      qrCodeUrl = await QRCode.toDataURL(newMaterialBarCode, {
        width: 200, // äºŒç»´ç å¤§å°é€‚配布局
      qrCodeUrl = await QRCode.toDataURL(materielCode, {
        width: 150, // é€‚配标识卡尺寸
        margin: 1
      });
    } catch (err) {
@@ -76,11 +51,11 @@
      return;
    }
    // 5. åˆ›å»ºå¼¹çª—
    // 4. åˆ›å»ºå¼¹çª—挂载节点
    const mountNode = document.createElement('div');
    document.body.appendChild(mountNode);
    // æ·»åŠ æ‰“å°ä¸“ç”¨æ ·å¼
    // æ‰“印专用样式
    const addPrintStyle = () => {
      const style = document.createElement('style');
      style.id = 'qr-print-style';
@@ -88,39 +63,61 @@
        @media print {
          body > *:not(.print-container) { display: none !important; }
          .print-container {
            position: fixed !important;
            top: 50px !important;
            left: 50px !important;
            width: 90% !important;
            height: auto !important;
              position: fixed !important;
              top: 0 !important;
              left: 0 !important;
              width: 100% !important;
              height: 100% !important;
              display: flex !important;
              align-items: center !important;
              justify-content: center !important;
              padding: 0 !important;
              margin: 0 !important;
          }
          /* æ‰“印内容布局 */
          .print-content {
            display: flex !important;
            flex-direction: column !important;
            gap: 20px !important;
          .material-card {
              border: 1px solid #000;
              padding: 5mm; /* ä½¿ç”¨æ¯«ç±³å•位更适配打印尺寸 */
              font-size: 2mm; /* æŒ‰æ¯”例缩小字体 */
              position: relative;
              width: 70mm; /* ç•¥å°äºŽçº¸å¼ å®½åº¦ï¼Œç•™è¾¹è· */
              height: 50mm; /* ç•¥å°äºŽçº¸å¼ é«˜åº¦ï¼Œç•™è¾¹è· */
              box-sizing: border-box; /* ç¡®ä¿padding不影响整体尺寸 */
          }
          .qr-wrapper {
            align-self: flex-start !important; /* äºŒç»´ç é å·¦ */
          .card-title {
            text-align: center;
            font-size: 2mm; /* æ ‡é¢˜ç•¥å¤§ */
            font-weight: bold;
            margin-top: 5mm; /* å‡å°é¡¶éƒ¨é—´è· */
            margin-right: 20mm; /* é€‚配缩小的二维码位置 */
          }
          .detail-fields {
            display: flex !important;
            justify-content: space-around !important; /* å­—段均匀分布 */
            width: 100% !important;
            margin-top: 20px !important;
            font-size: 16px !important;
          .card-fields {
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            gap: 1.5mm; /* ç¼©å°é—´è· */
            margin-top: 8mm; /* è°ƒæ•´å­—段容器位置 */
          }
          .field-item {
            text-align: center !important;
            padding: 10px !important;
            border: 1px solid #eee !important;
            border-radius: 4px !important;
            width: 30% !important; /* æ¯ä¸ªå­—段占1/3宽度 */
            width: 48%; /* ä¿æŒä¸¤åˆ—布局 */
            line-height: 1.3; /* ç´§å‡‘行高 */
          }
          .field-label {
            font-weight: bold !important;
            margin-bottom: 5px !important;
            display: block !important;
          .qr-wrapper {
            position: absolute;
            top: 5mm; /* è°ƒæ•´äºŒç»´ç é¡¶éƒ¨ä½ç½® */
            right: 3mm; /* è°ƒæ•´äºŒç»´ç å³ä¾§ä½ç½® */
            width: 15mm; /* äºŒç»´ç å°ºå¯¸é€‚配小卡片 */
            height: 15mm;
          }
          .qr-wrapper img {
            width: 100% !important; /* ç¡®ä¿äºŒç»´ç å¡«å……满容器 */
            height: 100% !important;
            object-fit: contain;
          }
        }
      `;
@@ -130,106 +127,83 @@
    // æ‰“印函数
    const printQrCode = () => {
      // åˆ›å»ºæ‰“印容器
      const printContainer = document.createElement('div');
      printContainer.className = 'print-container';
      printContainer.style = 'position:fixed; top:-9999px; left:-9999px;';
      document.body.appendChild(printContainer);
      // å¡«å……打印内容(布局:二维码左上角 + ä¸‰ä¸ªå­—段均匀分布)
      // æž„建物料标识卡HTML结构
      printContainer.innerHTML = `
        <div class="print-content">
          <!-- äºŒç»´ç ï¼ˆå·¦ä¸Šè§’) -->
          <div class="qr-wrapper">
            <img src="${qrCodeUrl}" style="width: 200px; height: 200px;" />
            <p style="margin-top: 10px; font-size: 16px;">单据编号:${newMaterialBarCode}</p>
        <div class="material-card">
          <div class="card-title">卓力能物料标识卡(小包)</div>
          <div class="card-fields">
            <div class="field-item">料号:${materielCode}</div>
            <div class="field-item">供应商编码:</div>
            <div class="field-item">品名:${materialName || '无'}</div>
            <div class="field-item">采购单号:</div>
            <div class="field-item">规格:${specification || '无'}</div>
            <div class="field-item">数量/总数:0PCS/0PCS</div>
            <div class="field-item">批号:${lotNo || '无'}</div>
            <div class="field-item">批次:${batchNo || '无'}</div>
            <div class="field-item">厂区:卓力能三厂</div>
            <div class="field-item">日期:${date || '无'}</div>
          </div>
          <!-- æ˜Žç»†å­—段(均匀分布) -->
          <div class="detail-fields">
            <div class="field-item">
              <span class="field-label">交易数量</span>
              <span>${detailList[0].qtyTrans}</span>
            </div>
            <div class="field-item">
              <span class="field-label">物料编码</span>
              <span>${detailList[0].materialCode}</span>
            </div>
            <div class="field-item">
              <span class="field-label">物料名称</span>
              <span>${detailList[0].materialName}</span>
            </div>
          <div class="qr-wrapper">
            <img src="${qrCodeUrl}" alt="物料二维码" />
          </div>
        </div>
      `;
      // æ·»åŠ æ‰“å°æ ·å¼
      const printStyle = addPrintStyle();
      // æ¸…理函数(防止重复移除)
      const cleanUp = () => {
        if (printContainer.parentNode === document.body) {
          document.body.removeChild(printContainer);
        }
        if (printStyle && printStyle.parentNode === document.head) {
          document.head.removeChild(printStyle);
        }
        document.body.removeChild(printContainer);
        document.head.removeChild(printStyle);
        window.removeEventListener('afterprint', cleanUp);
      };
      // ç›‘听打印完成
      window.addEventListener('afterprint', cleanUp, { once: true });
      // è§¦å‘打印
      window.print();
    };
    // å¼¹çª—组件(预览布局)
    // å¼¹çª—预览组件
    const vnode = createVNode(ElDialog, {
      title: '单据二维码及明细',
      width: '600px',
      title: '物料标识卡及二维码',
      width: '500px',
      modelValue: true,
      style: { maxHeight: '500px', overflowY: 'auto' },
      appendToBody: true,
      'onUpdate:modelValue': (isVisible) => {
        if (!isVisible) {
          const printStyle = document.getElementById('qr-print-style');
          if (printStyle && printStyle.parentNode === document.head) {
            document.head.removeChild(printStyle);
          }
          printStyle && document.head.removeChild(printStyle);
          render(null, mountNode);
          if (mountNode.parentNode === document.body) {
            document.body.removeChild(mountNode);
          }
          document.body.removeChild(mountNode);
        }
      }
    }, {
      default: () => [
        // é¢„览区布局(和打印布局一致)
        h('div', { style: { padding: '20px' } }, [
          // äºŒç»´ç é¢„览(左上角)
          h('div', { style: { marginBottom: '20px' } }, [
            h(ElImage, {
              src: qrCodeUrl,
              alt: '单据二维码',
              style: { width: '200px', height: '200px' }
            }),
            h('p', { style: { marginTop: '10px', fontSize: '16px' } }, `单据编号:${newMaterialBarCode}`)
          ]),
          // æ˜Žç»†å­—段预览(均匀分布)
        //   h('div', { style: { display: 'flex', justifyContent: 'space-around', gap: '10px' } }, [
        //     h('div', { style: { textAlign: 'center', padding: '10px', border: '1px solid #eee', width: '30%' } }, [
        //       h('div', { style: { fontWeight: 'bold', marginBottom: '5px' } }, '交易数量'),
        //       h('div', null, detailList[0].qtyTrans)
        //     ]),
        //     h('div', { style: { textAlign: 'center', padding: '10px', border: '1px solid #eee', width: '30%' } }, [
        //       h('div', { style: { fontWeight: 'bold', marginBottom: '5px' } }, '物料编码'),
        //       h('div', null, detailList[0].materialCode)
        //     ]),
        //     h('div', { style: { textAlign: 'center', padding: '10px', border: '1px solid #eee', width: '30%' } }, [
        //       h('div', { style: { fontWeight: 'bold', marginBottom: '5px' } }, '物料名称'),
        //       h('div', null, detailList[0].materialName)
        //     ])
        //   ])
          h('div', { style: { border: '1px solid #000', padding: '15px' ,position:'relative',height:'280px'} }, [
            h('div', { style: { textAlign: 'center', fontSize: '18px', fontWeight: 'bold', marginTop: '20px' ,marginRight:'100px'} }, '卓力能物料标识卡(小包)'),
            h('div', { style: { display: 'flex', flexWrap: 'wrap', justifyContent: 'space-between', gap: '10px',marginTop:'60px'} }, [
              h('div', { style: { width: '48%' } }, `料号:${materielCode}`),
              h('div', { style: { width: '48%' } }, '供应商编码:'),
              h('div', { style: { width: '48%' } }, `品名:${materialName || '无'}`),
              h('div', { style: { width: '48%' } }, '采购单号:'),
              h('div', { style: { width: '48%' } }, `规格:${specification || '无'}`),
              h('div', { style: { width: '48%' } }, '数量/总数:0PCS/0PCS'),
              h('div', { style: { width: '48%' } }, `批号:${lotNo || '无'}`),
              h('div', { style: { width: '48%' } }, `批次:${batchNo || '无'}`),
              h('div', { style: { width: '48%' } }, '厂区:卓力能三厂'),
              h('div', { style: { width: '48%' } }, `日期:${date || '无'}`),
            ]),
            h('div', { style: { position:'absolute',top:'1px',right:'15px',width:'100px',heigth:'100px' } }, [
              h(ElImage, {
                src: qrCodeUrl,
                alt: '物料二维码',
                style: { width: '100px', height: '100px' }
              })
            ])
          ])
        ])
      ],
      footer: () => h('div', null, [
@@ -237,18 +211,16 @@
          type: 'default',
          onClick: () => {
            const printStyle = document.getElementById('qr-print-style');
            if (printStyle) document.head.removeChild(printStyle);
            printStyle && document.head.removeChild(printStyle);
            render(null, mountNode);
            if (mountNode.parentNode === document.body) {
              document.body.removeChild(mountNode);
            }
            document.body.removeChild(mountNode);
          }
        }, '关闭'),
        h(ElButton, {
          type: 'primary',
          onClick: () => {
            ElMessageBox.confirm(
              '是否打印该内容?',
              '是否打印该物料标识卡?',
              '打印确认',
              {
                confirmButtonText: '确认打印',
@@ -257,21 +229,16 @@
              }
            ).then(async () => {
              try {
                // æ‰§è¡Œæ‰“印并等待完成,捕获可能的错误
                await printQrCode(); 
                setTimeout(() => {
                  render(null, mountNode);
                  if (mountNode.parentNode === document.body) {
                    document.body.removeChild(mountNode);
                  }
                  document.body.removeChild(mountNode);
                }, 500);
              } catch (printErr) {
                // æ˜¾ç¤ºçœŸå®žé”™è¯¯ï¼ˆè€Œéžâ€œå·²å–消”)
                ElMessage.error(`打印失败:${printErr.message || '未知错误'}`);
                console.error('打印错误:', printErr);
              }
            }).catch((err) => {
              // ä»…用户主动取消时才显示“已取消”
              if (err === 'cancel' || err.name === 'CanceledError') {
                ElMessage.info('已取消打印');
              }
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/views/inbound/Dt_MaterielToMes.vue
@@ -162,7 +162,7 @@
        sort: true
      },
      {
        field: "MaterielCode",
        field: "materielCode",
        title: "物料编号",
        type: "string",
        width: 180,
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1091.29919/CodeChunks.db
Binary files differ
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1091.29919/CodeChunks.db-shm
Binary files differ
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1091.29919/CodeChunks.db-wal
Binary files differ
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1091.29919/SemanticSymbols.db
Binary files differ
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1091.29919/SemanticSymbols.db-shm
Binary files differ
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1091.29919/SemanticSymbols.db-wal
Binary files differ
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/copilot-chat/13d2ebf8/sessions/5c08ea60-efea-4683-8780-e289f0bee8d0
Binary files differ
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_AllocateService/AllocateService.cs
@@ -1,24 +1,356 @@
using System;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common.AllocateEnum;
using WIDESEA_Core;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.CodeConfigEnum;
using WIDESEA_Core.DB;
using WIDESEA_Core.Enums;
using WIDESEA_Core.Seed;
using WIDESEA_IAllocateService;
using WIDESEA_IInboundService;
using WIDESEA_IOutboundService;
using WIDESEA_Model.Models;
using WIDESEA_Model.Models.Allocate;
namespace WIDESEA_AllocateService
{
    public partial class AllocateService : ServiceBase<Dt_AllocateOrder, IRepository<Dt_AllocateOrder>>, IAllocateService
    {
        public AllocateService(IRepository<Dt_AllocateOrder> BaseDal) : base(BaseDal)
        public readonly IUnitOfWorkManage _unitOfWorkManage;
        public readonly IInboundService _inboundService;
        public readonly IOutboundService _outboundService;
        public readonly IRepository<Dt_AllocateOrder> _allocateOrderRepository;
        public readonly IRepository<Dt_AllocateOrderDetail> _allocateOrderDetailRepository;
        public AllocateService(IRepository<Dt_AllocateOrder> BaseDal,
            IUnitOfWorkManage unitOfWorkManage,
            IInboundService inboundService,
            IOutboundService outboundService,
            IRepository<Dt_AllocateOrder> allocateOrderRepository,
            IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository) : base(BaseDal)
        {
            _unitOfWorkManage = unitOfWorkManage;
            _inboundService = inboundService;
            _outboundService = outboundService;
            _allocateOrderRepository = allocateOrderRepository;
            _allocateOrderDetailRepository = allocateOrderDetailRepository;
        }
        public IRepository<Dt_AllocateOrder> Repository => BaseDal;
        public WebResponseContent ReceiveAllocateOrder(Dt_AllocateOrder allocateOrder, int operateType)
        {
            try
            {
                return operateType switch
                {
                    1 => AddInboundOrder(allocateOrder),
                    2 => UpdateInboundOrder(allocateOrder),
                    3 => DeleteInboundOrder(allocateOrder),
                    _ => WebResponseContent.Instance.OK(),
                };
            }
            catch (Exception ex)
            {
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
        public WebResponseContent AddInboundOrder(Dt_AllocateOrder allocateOrder)
        {
            try
            {
                if (BaseDal.QueryFirst(x => x.UpperOrderNo == allocateOrder.UpperOrderNo) != null)
                {
                    return WebResponseContent.Instance.Error($"调拨单号重复");
                }
                allocateOrder.OrderNo = CreateCodeByRule(nameof(RuleCodeEnum.AllocateOrderCodeRule));
                Db.InsertNav(allocateOrder).Include(x => x.Details).ExecuteCommand();
                if (Enum.TryParse<BusinessTypeEnum>(allocateOrder.BusinessType, out var businessType))
                {
                    if (businessType == BusinessTypeEnum.外部仓库调智仓)
                    {
                        var inboundOrders = ConvertToInboundOrders(allocateOrder);
                        _inboundService.InbounOrderService.ReceiveInboundOrder(inboundOrders, 1);
                    }
                    else if (businessType == BusinessTypeEnum.智仓调外部仓库)
                    {
                        var outboundOrders = ConvertToOutboundOrders(allocateOrder);
                        _outboundService.OutboundOrderService.ReceiveOutboundOrder(outboundOrders, 1);
                    }
                    else
                    {
                        // å¤„理未定义的枚举值(如未来新增但未实现的类型)
                        throw new NotSupportedException($"不支持的业务类型枚举值: {businessType}");
                    }
                }
                return WebResponseContent.Instance.OK();
            }
            catch (Exception ex)
            {
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
        public WebResponseContent UpdateInboundOrder(Dt_AllocateOrder model)
        {
            try
            {
                    var allocateOrder = Db.Queryable<Dt_AllocateOrder>().Where(x => x.UpperOrderNo == model.UpperOrderNo).Includes(x => x.Details).First();
                    if (allocateOrder == null)
                    {
                        return WebResponseContent.Instance.Error($"未找到调拨单信息");
                    }
                    if (allocateOrder.Details == null || allocateOrder.Details.Count == 0)
                    {
                        return WebResponseContent.Instance.Error($"未找到调拨单明细信息");
                    }
                    List<Dt_AllocateOrderDetail> allocateOrderDetails = new List<Dt_AllocateOrderDetail>();
                    List<Dt_AllocateOrderDetail> updateAllocateOrderDetails = new List<Dt_AllocateOrderDetail>();
                    List<int> detailIds = new List<int>();
                    foreach (var item in model.Details)
                    {
                        if (string.IsNullOrEmpty(item.Barcode))
                        {
                        }
                        else
                        {
                            Dt_AllocateOrderDetail? allocateOrderDetail = allocateOrder.Details.FirstOrDefault(x => x.Barcode == item.Barcode);
                            if (allocateOrderDetail == null)
                            {
                                allocateOrderDetail = new Dt_AllocateOrderDetail()
                                {
                                    OrderId = allocateOrder.Id,
                                    MaterielCode = item.MaterielCode,
                                    LineNo= item.LineNo,
                                    BatchNo = item.BatchNo,
                                    Unit = item.Unit,
                                    WarehouseCode = item.WarehouseCode,
                                    Barcode = item.Barcode,
                                    BarcodeUnit = item.BarcodeUnit,
                                    BarcodeQty = (decimal)item.BarcodeQty,
                                    OrderQuantity = item.OrderQuantity
                                };
                                allocateOrderDetails.Add(allocateOrderDetail);
                            }
                            else
                            {
                                allocateOrderDetail.LineNo = item.LineNo;
                                allocateOrderDetail.MaterielCode = item.MaterielCode;
                                allocateOrderDetail.BatchNo = item.BatchNo;
                                allocateOrderDetail.Unit = item.Unit;
                                allocateOrderDetail.WarehouseCode = item.WarehouseCode;
                                allocateOrderDetail.Barcode = item.Barcode;
                                allocateOrderDetail.BarcodeUnit = item.BarcodeUnit;
                                allocateOrderDetail.BarcodeQty = item.BarcodeQty;
                                allocateOrderDetail.OrderQuantity = item.OrderQuantity;
                                updateAllocateOrderDetails.Add(allocateOrderDetail);
                                detailIds.Add(allocateOrderDetail.Id);
                            }
                        }
                    }
                    allocateOrder.UpperOrderNo = model.UpperOrderNo;
                    allocateOrder.BusinessType = model.BusinessType;
                    allocateOrder.IsBatch = model.IsBatch;
                    allocateOrder.FactoryArea = model.FactoryArea;
                    List<Dt_AllocateOrderDetail> deletePurchaseOrderDetails = allocateOrder.Details.Where(x => !detailIds.Contains(x.Id)).ToList();
                    _unitOfWorkManage.BeginTran();
                    foreach (var item in deletePurchaseOrderDetails)
                    {
                        _allocateOrderDetailRepository.DeleteAndMoveIntoHty(item, OperateTypeEnum.自动删除);
                    }
                    _allocateOrderDetailRepository.UpdateData(updateAllocateOrderDetails);
                    _allocateOrderDetailRepository.AddData(allocateOrderDetails);
                    BaseDal.UpdateData(allocateOrder);
                    _unitOfWorkManage.CommitTran();
                return WebResponseContent.Instance.OK();
            }
            catch (Exception ex)
            {
                _unitOfWorkManage.RollbackTran();
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
        public WebResponseContent DeleteInboundOrder(Dt_AllocateOrder model)
        {
            try
            {
                    var allocateOrder = Db.Queryable<Dt_AllocateOrder>().Where(x => x.UpperOrderNo == model.UpperOrderNo).Includes(x => x.Details).First();
                    if (allocateOrder == null)
                    {
                        return WebResponseContent.Instance.Error($"未找到调拨单信息");
                    }
                    if (allocateOrder.Details == null || allocateOrder.Details.Count == 0)
                    {
                        return WebResponseContent.Instance.Error($"未找到调拨单明细信息");
                    }
                    //Db.DeleteNav(inboundOrder).Include(x => x.Details).ExecuteCommand();
                    _unitOfWorkManage.BeginTran();
                    BaseDal.DeleteAndMoveIntoHty(allocateOrder, OperateTypeEnum.自动删除);
                    foreach (var item in allocateOrder.Details)
                    {
                        _allocateOrderDetailRepository.DeleteAndMoveIntoHty(item, OperateTypeEnum.自动删除);
                    }
                    _unitOfWorkManage.CommitTran();
                return WebResponseContent.Instance.OK();
            }
            catch (Exception ex)
            {
                _unitOfWorkManage.RollbackTran();
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
        public List<Dt_InboundOrder> ConvertToInboundOrders(Dt_AllocateOrder allocateOrder)
        {
            return new List<Dt_InboundOrder>()
            {
                new Dt_InboundOrder(){
                   WarehouseId= allocateOrder.WarehouseId,
                   InboundOrderNo=allocateOrder.OrderNo,
                   UpperOrderNo=allocateOrder.UpperOrderNo,
                   SupplierId=allocateOrder.SupplierId,
                   OrderType=allocateOrder.OrderType,
                   OrderStatus=allocateOrder.OrderStatus,
                   CreateType=allocateOrder.CreateType,
                   BusinessType=allocateOrder.BusinessType,
                   IsBatch=allocateOrder.IsBatch,
                   FactoryArea=allocateOrder.FactoryArea,
                   Remark=allocateOrder.Remark,
                   Details=allocateOrder.Details.Select(detail=>new Dt_InboundOrderDetail
                   {
                       OrderId= detail.OrderId,
                       MaterielCode=detail.MaterielCode,
                       MaterielName="",
                       BatchNo=detail.BatchNo,
                       OrderQuantity=detail.OrderQuantity,
                       ReceiptQuantity=detail.ReceiptQuantity,
                       OverInQuantity=detail.OverInQuantity,
                       OrderDetailStatus=detail.OrderDetailStatus,
                       Unit=detail.Unit,
                       RowNo=0,
                       SupplyCode="",
                       WarehouseCode=detail.WarehouseCode,
                       Barcode=detail.Barcode,
                       OutBoxbarcodes="",
                       BarcodeQty=(decimal)detail.BarcodeQty,
                       BarcodeUnit=detail.BarcodeUnit
                   }).ToList()
                }
            };
        }
        public Dt_OutboundOrder ConvertToOutboundOrders(Dt_AllocateOrder allocateOrder)
        {
            return new Dt_OutboundOrder()
            {
                   WarehouseId= allocateOrder.WarehouseId,
                   OrderNo=allocateOrder.OrderNo,
                   UpperOrderNo=allocateOrder.UpperOrderNo,
                   OrderType=allocateOrder.OrderType,
                   OrderStatus=allocateOrder.OrderStatus,
                   CreateType=allocateOrder.CreateType,
                   BusinessType=allocateOrder.BusinessType,
                   IsBatch=allocateOrder.IsBatch,
                   FactoryArea=allocateOrder.FactoryArea,
                   Remark=allocateOrder.Remark,
                   DepartmentCode="",
                   DepartmentName="",
                   Details=allocateOrder.Details.Select(detail=>new Dt_OutboundOrderDetail
                   {
                       OrderId= detail.OrderId,
                       MaterielCode=detail.MaterielCode,
                       MaterielName="",
                       BatchNo=detail.BatchNo,
                       OrderQuantity=detail.OrderQuantity,
                       LockQuantity=0,
                       OverOutQuantity=0,
                       OrderDetailStatus=detail.OrderDetailStatus,
                       Unit=detail.Unit,
                       RowNo=0,
                       SupplyCode="",
                       WarehouseCode=detail.WarehouseCode,
                   }).ToList()
            };
        }
        static object lock_code = new object();
        public string CreateCodeByRule(string ruleCode)
        {
            lock (lock_code)
            {
                string code = string.Empty;
                DateTime dateTime = DateTime.Now;
                DateTime now = DateTime.Now;
                try
                {
                    if (string.IsNullOrEmpty(ruleCode))
                        throw new ArgumentNullException(nameof(ruleCode));
                    SqlSugarClient sugarClient = new SqlSugarClient(new ConnectionConfig
                    {
                        IsAutoCloseConnection = true,
                        DbType = DbType.SqlServer,
                        ConnectionString = DBContext.ConnectionString
                    });
                    Dt_CodeRuleConfig codeRuleConfig = sugarClient.Queryable<Dt_CodeRuleConfig>().Where(x => x.RuleCode == ruleCode).First();
                    if (codeRuleConfig == null)
                        throw new ArgumentNullException(nameof(codeRuleConfig));
                    if (codeRuleConfig.ModifyDate != null)
                    {
                        dateTime = Convert.ToDateTime(codeRuleConfig.ModifyDate);
                    }
                    else
                    {
                        dateTime = Convert.ToDateTime(codeRuleConfig.CreateDate);
                    }
                    if (now.Year == dateTime.Year && now.Month == dateTime.Month && now.Day == dateTime.Day)
                    {
                        now = dateTime;
                        codeRuleConfig.CurrentVal = Convert.ToInt32(codeRuleConfig.CurrentVal) + 1;
                    }
                    else
                    {
                        codeRuleConfig.CurrentVal = 1;
                    }
                    codeRuleConfig.ModifyDate = DateTime.Now;
                    code = codeRuleConfig.StartStr + codeRuleConfig.Format;
                    code = code.Replace($"[{CodeFormatTypeEnum.YYYY}]", now.Year.ToString().PadLeft(4, '0'));
                    code = code.Replace($"[{CodeFormatTypeEnum.MM}]", now.Month.ToString().PadLeft(2, '0'));
                    code = code.Replace($"[{CodeFormatTypeEnum.DD}]", now.Day.ToString().PadLeft(2, '0'));
                    code = code.Replace($"[{CodeFormatTypeEnum.ST}]", codeRuleConfig.StartStr?.ToString() ?? "");
                    code = code.Replace($"[{CodeFormatTypeEnum.NUM}]", codeRuleConfig.CurrentVal.ToString().PadLeft(codeRuleConfig.Length, '0'));
                    Dictionary<string, object> keyValuePairs = new Dictionary<string, object>() { { nameof(codeRuleConfig.CurrentVal), codeRuleConfig.CurrentVal }, { nameof(codeRuleConfig.Id), codeRuleConfig.Id }, { nameof(codeRuleConfig.ModifyDate), DateTime.Now } };
                    sugarClient.Updateable(keyValuePairs).AS(MainDb.CodeRuleConfig).WhereColumns(nameof(codeRuleConfig.Id)).ExecuteCommand();
                    sugarClient.Updateable(codeRuleConfig);
                }
                catch (Exception ex)
                {
                }
                return code;
            }
        }
    }
}
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_AllocateService/WIDESEA_AllocateService.csproj
@@ -9,6 +9,8 @@
  <ItemGroup>
    <ProjectReference Include="..\WIDESEA_Core\WIDESEA_Core.csproj" />
    <ProjectReference Include="..\WIDESEA_IAllocateService\WIDESEA_IAllocateService.csproj" />
    <ProjectReference Include="..\WIDESEA_IInboundService\WIDESEA_IInboundService.csproj" />
    <ProjectReference Include="..\WIDESEA_IOutboundService\WIDESEA_IOutboundService.csproj" />
    <ProjectReference Include="..\WIDESEA_Model\WIDESEA_Model.csproj" />
  </ItemGroup>
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Common/AllocateEnum/BusinessTypeEnum.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WIDESEA_Common.AllocateEnum
{
    public enum BusinessTypeEnum
    {
        æ™ºä»“调智仓=1,
        æ™ºä»“调外部仓库=2,
        å¤–部仓库调智仓=3
    }
}
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Core/CodeConfigEnum/RuleCodeEnum.cs
@@ -44,6 +44,11 @@
        /// å…¥æ–™å•号编码规则
        /// </summary>
        [Description("入料单号编码规则")]
        RLCodeRule
        RLCodeRule,
        /// <summary>
        /// è°ƒæ‹¨å•号编码规则
        /// </summary>
        [Description("调拨单号编码规则")]
        AllocateOrderCodeRule
    }
}
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_DTO/Allocate/AllocateDto.cs
@@ -4,6 +4,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_DTO.Inbound;
namespace WIDESEA_DTO.Allocate
{
@@ -136,4 +137,6 @@
        [JsonProperty("unit")]
        public string Unit { get; set; }
    }
}
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_IAllocateService/IAllocateService.cs
@@ -3,10 +3,11 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
using WIDESEA_Model.Models;
using WIDESEA_Model.Models.Allocate;
namespace WIDESEA_IAllocateService
{
@@ -14,5 +15,7 @@
    public interface IAllocateService : IService<Dt_AllocateOrder>
    {
        IRepository<Dt_AllocateOrder> Repository { get; }
        WebResponseContent ReceiveAllocateOrder(Dt_AllocateOrder allocateOrder, int operateType);
    }
}
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Model/Models/Allocate/Dt_ AllocateOrder.cs
@@ -1,18 +1,110 @@
using SqlSugar;
using MailKit.Search;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.DB.Models;
namespace WIDESEA_Model.Models.Allocate
namespace WIDESEA_Model.Models
{
    /// <summary>
    ///
    /// è°ƒæ‹¨å•
    /// </summary>
    [SugarTable(nameof(Dt_InboundOrder), "入库单")]
    [SugarTable(nameof(Dt_AllocateOrder), "调拨单")]
    public class Dt_AllocateOrder : BaseEntity
    {
    {
        /// <summary>
        /// ä¸»é”®ID(自增)
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主键")]
        public int Id { get; set; }
        /// <summary>
        /// ä»“库ID
        /// </summary>
        [SugarColumn(IsNullable = false, ColumnDescription = "仓库ID")]
        public int WarehouseId { get; set; }
        /// <summary>
        /// è®¢å•编号
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "订单编号")]
        public string OrderNo { get; set; }
        /// <summary>
        /// ä¸Šçº§è®¢å•编号
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "上级订单编号")]
        public string UpperOrderNo { get; set; }
        /// <summary>
        /// ä¾›åº”商ID
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "供应商ID")]
        public string SupplierId { get; set; }
        /// <summary>
        /// è®¢å•类型
        /// </summary>
        [SugarColumn(IsNullable = false, ColumnDescription = "订单类型")]
        public int OrderType { get; set; }
        /// <summary>
        /// è®¢å•状态
        /// </summary>
        [SugarColumn(IsNullable = false, ColumnDescription = "订单状态")]
        public int OrderStatus { get; set; }
        /// <summary>
        /// åˆ›å»ºç±»åž‹
        /// </summary>
        [SugarColumn(IsNullable = false, ColumnDescription = "创建类型")]
        public int CreateType { get; set; }
        /// <summary>
        /// ä¸šåŠ¡ç±»åž‹
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "业务类型")]
        public string BusinessType { get; set; }
        /// <summary>
        /// æ¥æºä»“库
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "来源仓库")]
        public string FromWarehouse { get; set; }
        /// <summary>
        /// ç›®æ ‡ä»“库
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "目标仓库")]
        public string ToWarehouse { get; set; }
        /// <summary>
        /// æ˜¯å¦æ‰¹æ¬¡
        /// </summary>
        [SugarColumn(IsNullable = false, ColumnDescription = "是否批次")]
        public bool? IsBatch { get; set; }
        /// <summary>
        /// åŽ‚åŒº
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "厂区")]
        public string FactoryArea { get; set; }
        /// <summary>
        /// å¤‡æ³¨
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 200, ColumnDescription = "备注")]
        public string Remark { get; set; }
        /// <summary>
        /// è°ƒæ‹¨å•明细
        /// </summary>
        [Navigate(NavigateType.OneToMany, nameof(Dt_AllocateOrderDetail.OrderId), nameof(Id))]
        public List<Dt_AllocateOrderDetail> Details { get; set; }
    }
}
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Model/Models/Allocate/Dt_AllocateOrderDetail.cs
@@ -1,12 +1,110 @@
using System;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.DB.Models;
namespace WIDESEA_Model.Models.Allocate
namespace WIDESEA_Model.Models
{
    public class Dt_AllocateOrderDetail
    /// <summary>
    /// è°ƒæ‹¨å•明细
    /// </summary>
    [SugarTable(nameof(Dt_AllocateOrderDetail), "调拨单明细")]
    public class Dt_AllocateOrderDetail : BaseEntity
    {
        /// <summary>
        /// ä¸»é”®ID(自增)
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主键")]
        public int Id { get; set; }
        /// <summary>
        /// å…³è”订单ID(对应Dt_AllocateOrder.Id)
        /// </summary>
        [SugarColumn(IsNullable = false, ColumnDescription = "关联订单ID")]
        public int OrderId { get; set; }
        /// <summary>
        /// ç‰©æ–™ç¼–码
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "物料编码")]
        public string MaterielCode { get; set; }
        /// <summary>
        /// æ‰¹æ¬¡å·
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "批次号")]
        public string BatchNo { get; set; }
        /// <summary>
        /// è®¢å•数量
        /// </summary>
        [SugarColumn(IsNullable = false, ColumnDescription = "订单数量")]
        public decimal OrderQuantity { get; set; }
        /// <summary>
        /// æ”¶è´§æ•°é‡
        /// </summary>
        [SugarColumn(IsNullable = false, ColumnDescription = "收货数量")]
        public decimal ReceiptQuantity { get; set; }
        /// <summary>
        /// è¶…额入库数量
        /// </summary>
        [SugarColumn(IsNullable = false, ColumnDescription = "超额入库数量")]
        public decimal OverInQuantity { get; set; }
        /// <summary>
        /// æ˜Žç»†çŠ¶æ€
        /// </summary>
        [SugarColumn(IsNullable = false, ColumnDescription = "明细状态")]
        public int OrderDetailStatus { get; set; }
        /// <summary>
        /// å•位
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "单位")]
        public string Unit { get; set; }
        /// <summary>
        /// è¡Œå·
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "行号")]
        public string LineNo { get; set; }
        /// <summary>
        /// ä»“库编码
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "仓库编码")]
        public string WarehouseCode { get; set; }
        /// <summary>
        /// æ¡å½¢ç 
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "条形码")]
        public string Barcode { get; set; }
        /// <summary>
        /// æ¡å½¢ç æ•°é‡
        /// </summary>
        [SugarColumn(IsNullable = false, ColumnDescription = "条形码数量")]
        public decimal? BarcodeQty { get; set; }
        /// <summary>
        /// æ¡å½¢ç å•位
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "条形码单位")]
        public string BarcodeUnit { get; set; }
        /// <summary>
        /// å¤‡æ³¨
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 255, ColumnDescription = "备注")]
        public string Remark { get; set; }
    }
}
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Model/Models/Inbound/Dt_InboundOrder.cs
@@ -78,7 +78,7 @@
        /// é»˜è®¤å€¼:
        ///</summary>
        [SugarColumn(ColumnName = "isBatch", ColumnDescription = "是否分批")]
        public int? IsBatch { get; set; }
        public bool? IsBatch { get; set; }
        /// <summary>
        /// å¤‡  æ³¨:厂区
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_OutboundOrder.cs
@@ -84,7 +84,7 @@
        /// é»˜è®¤å€¼:
        ///</summary>
        [SugarColumn(ColumnName = "isBatch", ColumnDescription = "是否分批")]
        public int? IsBatch { get; set; }
        public bool? IsBatch { get; set; }
        /// <summary>
        /// å¤‡  æ³¨:厂区
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Allocate/AllocateOrderController.cs
@@ -1,9 +1,15 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Data.Common;
using System.Diagnostics.Eventing.Reader;
using WIDESEA_Core;
using WIDESEA_Core.Attributes;
using WIDESEA_Core.BaseController;
using WIDESEA_DTO.Allocate;
using WIDESEA_IAllocateService;
using WIDESEA_IInboundService;
using WIDESEA_Model.Models;
using WIDESEA_Model.Models.Allocate;
namespace WIDESEA_WMSServer.Controllers.Allocate
{
@@ -19,7 +25,60 @@
        {
        }
        [HttpPost, Route("ReceiveAllocateOrder"), MethodParamsValidate, AllowAnonymous]
        public WebResponseContent ReceiveAllocateOrder([FromBody] AllocateDto model)
        {
            Dt_AllocateOrder allocateOrder = new Dt_AllocateOrder
            {
                OrderNo = model.OrderNo,
                UpperOrderNo = model.OrderNo,
                BusinessType=model.BusinessType,
                FactoryArea=model.FactoryArea,
                IsBatch=model.IsBatch,
                CreateType = model.OperationType,
                Details = new List<Dt_AllocateOrderDetail>()
            };
            foreach (var detailDto in model.Details)
            {
                if (detailDto.Barcodes != null && detailDto.Barcodes.Any())
                {
                    foreach (var barcodeDto in detailDto.Barcodes)
                    {
                        Dt_AllocateOrderDetail orderDetail = new Dt_AllocateOrderDetail
                        {
                            WarehouseCode = detailDto.WarehouseCode,
                            MaterielCode = detailDto.MaterialCode,
                            LineNo = detailDto.LineNo,
                            OrderQuantity = detailDto.Qty,
                            Unit = detailDto.Unit,
                            Barcode = barcodeDto.Barcode,
                            BatchNo = barcodeDto.BatchNo,
                            BarcodeQty = barcodeDto.Qty,
                            BarcodeUnit = barcodeDto.Unit
                        };
                        allocateOrder.Details.Add(orderDetail);
                    }
                }
                else
                {
                    Dt_AllocateOrderDetail orderDetail = new Dt_AllocateOrderDetail
                    {
                        WarehouseCode = detailDto.WarehouseCode,
                        MaterielCode = detailDto.MaterialCode,
                        LineNo = detailDto.LineNo,
                        OrderQuantity = detailDto.Qty,
                        Unit = detailDto.Unit
                    };
                    allocateOrder.Details.Add(orderDetail);
                }
                allocateOrder.Details.AddRange(allocateOrder.Details);
            }
            var content = Service.ReceiveAllocateOrder(allocateOrder, model.OperationType);
            if (content.Status) return WebResponseContent.Instance.OK(200);
            else return WebResponseContent.Instance.Error(content.Message);
        }
    }
}
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
@@ -12,7 +12,7 @@
  "MainDB": "DB_WIDESEA", //当前项目的主库,所对应的连接字符串的Enabled必须为true
  //连接字符串
  //"ConnectionString": "HTI6FB1H05Krd07mNm9yBCNhofW6edA5zLs9TY~MNthRYW3kn0qKbMIsGp~3yyPDF1YZUCPBQx8U0Jfk4PH~ajNFXVIwlH85M3F~v_qKYQ3CeAz3q1mLVDn8O5uWt1~3Ut2V3KRkEwYHvW2oMDN~QIDXPxDgXN0R2oTIhc9dNu7QNaLEknblqmHhjaNSSpERdDVZIgHnMKejU_SL49tralBkZmDNi0hmkbL~837j1NWe37u9fJKmv91QPb~16JsuI9uu0EvNZ06g6PuZfOSAeFH9GMMIZiketdcJG3tHelo=",
  "ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWMS_ALDZhongRui;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  "ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWMS_ALDZhongRui;User ID=sa;Password=root;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  //"ConnectionString": "Data Source=10.30.4.92;Initial Catalog=WMS_TC;User ID=sa;Password=duo123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  //旧WMS数据库连接
  //"TeConnectionString": "Data Source=10.30.4.92;Initial Catalog=TeChuang;User ID=sa;Password=duo123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",