| | |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | tableAction: '', |
| | | buttons: { view: [{ |
| | | name: 'çæäºç»´ç ', |
| | | name: 'çæäºç»´ç ', |
| | | type: 'success', |
| | | value: 'çæäºç»´ç ', |
| | | onClick: async function () { |
| | |
| | | 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) { |
| | |
| | | return; |
| | | } |
| | | |
| | | // 5. åå»ºå¼¹çª |
| | | // 4. åå»ºå¼¹çªæè½½èç¹ |
| | | const mountNode = document.createElement('div'); |
| | | document.body.appendChild(mountNode); |
| | | |
| | | // æ·»å æå°ä¸ç¨æ ·å¼ |
| | | // æå°ä¸ç¨æ ·å¼ |
| | | const addPrintStyle = () => { |
| | | const style = document.createElement('style'); |
| | | style.id = 'qr-print-style'; |
| | |
| | | @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; |
| | | } |
| | | } |
| | | `; |
| | |
| | | |
| | | // æå°å½æ° |
| | | 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, [ |
| | |
| | | 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: '确认æå°', |
| | |
| | | } |
| | | ).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('已忶æå°'); |
| | | } |
| | |
| | | sort: true |
| | | }, |
| | | { |
| | | field: "MaterielCode", |
| | | field: "materielCode", |
| | | title: "ç©æç¼å·", |
| | | type: "string", |
| | | width: 180, |
| | |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | <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> |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 |
| | | } |
| | | } |
| | |
| | | /// å
¥æåå·ç¼ç è§å |
| | | /// </summary> |
| | | [Description("å
¥æåå·ç¼ç è§å")] |
| | | RLCodeRule |
| | | RLCodeRule, |
| | | /// <summary> |
| | | /// è°æ¨åå·ç¼ç è§å |
| | | /// </summary> |
| | | [Description("è°æ¨åå·ç¼ç è§å")] |
| | | AllocateOrderCodeRule |
| | | } |
| | | } |
| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_DTO.Inbound; |
| | | |
| | | namespace WIDESEA_DTO.Allocate |
| | | { |
| | |
| | | [JsonProperty("unit")] |
| | | public string Unit { get; set; } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | 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 |
| | | { |
| | |
| | | public interface IAllocateService : IService<Dt_AllocateOrder> |
| | | { |
| | | IRepository<Dt_AllocateOrder> Repository { get; } |
| | | |
| | | WebResponseContent ReceiveAllocateOrder(Dt_AllocateOrder allocateOrder, int operateType); |
| | | } |
| | | } |
| | |
| | | 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; } |
| | | } |
| | | } |
| | |
| | | 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; } |
| | | } |
| | | } |
| | |
| | | /// é»è®¤å¼: |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "isBatch", ColumnDescription = "æ¯å¦åæ¹")] |
| | | public int? IsBatch { get; set; } |
| | | public bool? IsBatch { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å¤ æ³¨:ååº |
| | |
| | | /// é»è®¤å¼: |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "isBatch", ColumnDescription = "æ¯å¦åæ¹")] |
| | | public int? IsBatch { get; set; } |
| | | public bool? IsBatch { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å¤ æ³¨:ååº |
| | |
| | | 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 |
| | | { |
| | |
| | | { |
| | | } |
| | | |
| | | [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); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | "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", |