已添加15个文件
已重命名1个文件
已修改45个文件
| | |
| | | const formItems = reactive([ |
| | | { |
| | | label: 'ç©æç¼ç ', |
| | | prop: 'materialCode', |
| | | prop: 'materialNo', |
| | | el: 'input', |
| | | disabled: disabled, |
| | | placeholder: '请è¾å
¥ç©æç¼ç ', |
| | |
| | | const onConfirm = async () => { |
| | | await formRef.value?.validate() |
| | | const data = { |
| | | materialCode: formData.value.materialCode, |
| | | materialNo: formData.value.materialNo, |
| | | materialName: formData.value.materialName, |
| | | purchaseType: formData.value.purchaseType, |
| | | materialType: formData.value.materialType, |
| | |
| | | const res = await wmsMaterialDrawer.getWmsMaterialDetail(current.value) |
| | | |
| | | formData.value = { |
| | | materialCode: res.materialCode, |
| | | materialNo: res.materialNo, |
| | | materialName: res.materialName, |
| | | purchaseType: res.purchaseType, |
| | | materialType: res.materialType, |
| | |
| | | title: 'åºå·', |
| | | }, |
| | | { |
| | | field: 'materialCode', |
| | | field: 'materialNo', |
| | | title: 'ç©æç¼ç ', |
| | | }, |
| | | { |
| | |
| | | |
| | | // æ°å¢çæ¥è¯¢æ¡ä»¶ |
| | | const queryForm = ref({ |
| | | materialCode: '', |
| | | materialNo: '', |
| | | materialName: '', |
| | | materialType: '', |
| | | purchaseType: '', |
| | |
| | | // éç½®æ¥è¯¢æ¡ä»¶ |
| | | const resetQuery = () => { |
| | | queryForm.value = { |
| | | materialCode: '', |
| | | materialNo: '', |
| | | materialName: '', |
| | | materialType: '', |
| | | purchaseType: '', |
| | |
| | | </ElFormItem> |
| | | <ElFormItem label="ç©æç¼ç "> |
| | | <ElInput |
| | | v-model={queryForm.value.materialCode} |
| | | v-model={queryForm.value.materialNo} |
| | | placeholder="请è¾å
¥ç©æç¼ç " |
| | | clearable |
| | | class={styles.formItem} |
| | |
| | | materialName: '', |
| | | containerType: '', |
| | | containerStatus: '', |
| | | storageTypeNo: '', |
| | | storageTypeNo: 1, |
| | | placeStatus: '', |
| | | placeNo: '', |
| | | isLock: '', |
| | |
| | | ...queryForm.value, |
| | | containerType: queryForm.value.containerType || '', // å¤ç䏿 |
| | | containerStatus: queryForm.value.containerStatus || '', |
| | | storageTypeNo: queryForm.value.storageTypeNo || '', // å¤ç䏿 |
| | | storageTypeNo: queryForm.value.storageTypeNo || 1, // å¤ç䏿 |
| | | placeStatus: queryForm.value.placeStatus || '', |
| | | islock: queryForm.value.isLock || '', |
| | | emptyContainer: queryForm.value.emptyContainer || '', |
| | |
| | | // ç»ä»¶æè½½æ¶è·åæä¸¾æ°æ® |
| | | onMounted(() => { |
| | | fetchEnumData() |
| | | handleQuery() |
| | | }) |
| | | |
| | | // æ°å¢çæ¥è¯¢æ¹æ³ |
| | |
| | | materialName: '', |
| | | containerType: '', |
| | | containerStatus: '', |
| | | storageTypeNo: '', |
| | | storageTypeNo: 1, |
| | | placeStatus: '', |
| | | placeNo: '', |
| | | isLock: '', |
| | |
| | | params, |
| | | autoHeight, |
| | | } = props |
| | | |
| | | props.params = { |
| | | ...queryParams.value, |
| | | ...params, |
| | | } |
| | | return ( |
| | | <div |
| | | class={{ |
| | |
| | | <ElSelect |
| | | v-model={queryForm.value.storageTypeNo} |
| | | placeholder="è¯·éæ©æçç±»å" |
| | | clearable |
| | | loading={enumOptions.storageTypeNo.length === 0} |
| | | class={styles.formItem} |
| | | > |
| | |
| | | /// <summary> |
| | | /// ç»å®æ°é |
| | | /// </summary> |
| | | public int MaterialStockNumber { get; set; } |
| | | public int StockNumber { get; set; } |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | public string MaterialModelDesc { get; set; } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åºä½å表è¾åº |
| | | /// </summary> |
| | | public class PlaceListOutput |
| | | { |
| | | /// <summary> |
| | | /// åºä½å· |
| | | /// </summary> |
| | | public string PlaceNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åºä½å· |
| | | /// </summary> |
| | | public string PlaceNoDesc { get; set; } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using CmsQueryExtensions.Extension; |
| | | using Volo.Abp.Application.Dtos; |
| | | |
| | | namespace CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsContainerPlace; |
| | | |
| | | /// <summary> |
| | | /// åºä½å®¹å¨å
³ç³»æ¥è¯¢åæ° |
| | | /// </summary> |
| | | public class GetWmsContainerPlaceInput : ExtensiblePagedAndSortedResultRequestDto |
| | | { |
| | | |
| | | #region å
³é®åæ¥è¯¢ |
| | | |
| | | /// <summary> |
| | | /// å
³é®åæ¨¡ç³æ¥è¯¢ï¼æ³¨ææ¯å°åï¼ï¼ |
| | | /// </summary> |
| | | public string searchVal { get; set; } |
| | | |
| | | /// <summary> |
| | | /// éç¨æ¥è¯¢é
ç½® (1:æ¨¡ç³æ¥è¯¢ , 2:ç²¾åæ¥è¯¢)ï¼æ³¨ææ¯å°åï¼ï¼ |
| | | /// </summary> |
| | | public SearchFilterModeEnum searchVal_FilterMode { get; set; } = SearchFilterModeEnum.æ¨¡ç³æ¥è¯¢; |
| | | |
| | | /// <summary> |
| | | /// åæç´¢ç»ä»¶ä¼ éçéç¨æ¥è¯¢é
ç½®ç屿§åï¼æ³¨ææ¯å°åï¼ï¼ |
| | | /// </summary> |
| | | [NoAutoQuery] |
| | | public string str_searchFormInputAttrs { get; set; } |
| | | /// <summary> |
| | | /// åæç´¢ç»ä»¶ä¼ éçéç¨æ¥è¯¢é
ç½®ç屿§åï¼æ³¨ææ¯å°åï¼ï¼ |
| | | /// </summary> |
| | | public List<string> searchFormInputAttrs |
| | | { |
| | | get |
| | | { |
| | | if (!string.IsNullOrEmpty(str_searchFormInputAttrs)) |
| | | { |
| | | return str_searchFormInputAttrs.Split(',').ToList(); |
| | | } |
| | | return new List<string>(); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// åºä½ç¼ç |
| | | /// </summary> |
| | | public string PlaceNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åºä½ç¼ç -æ¥è¯¢å
³ç³»è¿ç®ç¬¦ |
| | | /// </summary> |
| | | public SearchFilterModeEnum PlaceNo_FilterMode { get; set; }= SearchFilterModeEnum.æ¨¡ç³æ¥è¯¢; |
| | | |
| | | /// <summary> |
| | | /// ç¼ç |
| | | /// </summary> |
| | | public string ContainerNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¼ç -æ¥è¯¢å
³ç³»è¿ç®ç¬¦ |
| | | /// </summary> |
| | | public SearchFilterModeEnum ContainerNo_FilterMode { get; set; }= SearchFilterModeEnum.æ¨¡ç³æ¥è¯¢; |
| | | |
| | | /// <summary> |
| | | /// æåº |
| | | /// </summary> |
| | | public int? Sort { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æåº-æ¥è¯¢å
³ç³»è¿ç®ç¬¦ |
| | | /// </summary> |
| | | public SearchFilterModeEnum Sort_FilterMode { get; set; }= SearchFilterModeEnum.ç²¾åæ¥è¯¢; |
| | | |
| | | /// <summary> |
| | | /// åç§° |
| | | /// </summary> |
| | | //è¡¨ç¤ºæ¯ é«çº§æ¥è¯¢èå´æ¥è¯¢ç¹æ§ |
| | | [HighSearchRangeAttribute] |
| | | public List<string> BindTime { get; set; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// æ¯å¦ç¦ç¨ |
| | | /// </summary> |
| | | public bool? IsDisabled { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¯å¦ç¦ç¨-æ¥è¯¢å
³ç³»è¿ç®ç¬¦ |
| | | /// </summary> |
| | | public SearchFilterModeEnum IsDisabled_FilterMode { get; set; }= SearchFilterModeEnum.ç²¾åæ¥è¯¢; |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | public string Remark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨-æ¥è¯¢å
³ç³»è¿ç®ç¬¦ |
| | | /// </summary> |
| | | public SearchFilterModeEnum Remark_FilterMode { get; set; }= SearchFilterModeEnum.æ¨¡ç³æ¥è¯¢; |
| | | |
| | | /// <summary> |
| | | /// å建æ¶é´ |
| | | /// </summary> |
| | | //è¡¨ç¤ºæ¯ é«çº§æ¥è¯¢èå´æ¥è¯¢ç¹æ§ |
| | | [HighSearchRangeAttribute] |
| | | public List<string> CreationTime { get; set; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// å建人ID |
| | | /// </summary> |
| | | public string CreatorId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å建人ID-æ¥è¯¢å
³ç³»è¿ç®ç¬¦ |
| | | /// </summary> |
| | | public SearchFilterModeEnum CreatorId_FilterMode { get; set; }= SearchFilterModeEnum.æ¨¡ç³æ¥è¯¢; |
| | | |
| | | /// <summary> |
| | | /// ä¿®æ¹æ¶é´ |
| | | /// </summary> |
| | | //è¡¨ç¤ºæ¯ é«çº§æ¥è¯¢èå´æ¥è¯¢ç¹æ§ |
| | | [HighSearchRangeAttribute] |
| | | public List<string> LastModificationTime { get; set; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// ä¿®æ¹äººID |
| | | /// </summary> |
| | | public string LastModifierId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¿®æ¹äººID-æ¥è¯¢å
³ç³»è¿ç®ç¬¦ |
| | | /// </summary> |
| | | public SearchFilterModeEnum LastModifierId_FilterMode { get; set; }= SearchFilterModeEnum.æ¨¡ç³æ¥è¯¢; |
| | | |
| | | /// <summary> |
| | | /// æ¯å¦å é¤ |
| | | /// </summary> |
| | | public bool? IsDeleted { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¯å¦å é¤-æ¥è¯¢å
³ç³»è¿ç®ç¬¦ |
| | | /// </summary> |
| | | public SearchFilterModeEnum IsDeleted_FilterMode { get; set; }= SearchFilterModeEnum.ç²¾åæ¥è¯¢; |
| | | |
| | | /// <summary> |
| | | /// å é¤äººID |
| | | /// </summary> |
| | | public string DeleterId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å é¤äººID-æ¥è¯¢å
³ç³»è¿ç®ç¬¦ |
| | | /// </summary> |
| | | public SearchFilterModeEnum DeleterId_FilterMode { get; set; }= SearchFilterModeEnum.æ¨¡ç³æ¥è¯¢; |
| | | |
| | | /// <summary> |
| | | /// å 餿¶é´ |
| | | /// </summary> |
| | | //è¡¨ç¤ºæ¯ é«çº§æ¥è¯¢èå´æ¥è¯¢ç¹æ§ |
| | | [HighSearchRangeAttribute] |
| | | public List<string> DeletionTime { get; set; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// å建人 |
| | | /// </summary> |
| | | public string CreatorName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å建人-æ¥è¯¢å
³ç³»è¿ç®ç¬¦ |
| | | /// </summary> |
| | | public SearchFilterModeEnum CreatorName_FilterMode { get; set; }= SearchFilterModeEnum.æ¨¡ç³æ¥è¯¢; |
| | | |
| | | /// <summary> |
| | | /// å é¤å¤æ³¨ |
| | | /// </summary> |
| | | public string DeleteRemark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å é¤å¤æ³¨-æ¥è¯¢å
³ç³»è¿ç®ç¬¦ |
| | | /// </summary> |
| | | public SearchFilterModeEnum DeleteRemark_FilterMode { get; set; }= SearchFilterModeEnum.æ¨¡ç³æ¥è¯¢; |
| | | |
| | | /// <summary> |
| | | /// æ©å±å段1 |
| | | /// </summary> |
| | | public string ExtraField1 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ©å±å段1-æ¥è¯¢å
³ç³»è¿ç®ç¬¦ |
| | | /// </summary> |
| | | public SearchFilterModeEnum ExtraField1_FilterMode { get; set; }= SearchFilterModeEnum.æ¨¡ç³æ¥è¯¢; |
| | | |
| | | /// <summary> |
| | | /// æ©å±å段2 |
| | | /// </summary> |
| | | public string ExtraField2 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ©å±å段2-æ¥è¯¢å
³ç³»è¿ç®ç¬¦ |
| | | /// </summary> |
| | | public SearchFilterModeEnum ExtraField2_FilterMode { get; set; }= SearchFilterModeEnum.æ¨¡ç³æ¥è¯¢; |
| | | |
| | | /// <summary> |
| | | /// æ©å±å段3 |
| | | /// </summary> |
| | | public string ExtraField3 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ©å±å段3-æ¥è¯¢å
³ç³»è¿ç®ç¬¦ |
| | | /// </summary> |
| | | public SearchFilterModeEnum ExtraField3_FilterMode { get; set; }= SearchFilterModeEnum.æ¨¡ç³æ¥è¯¢; |
| | | |
| | | /// <summary> |
| | | /// ä¿®æ¹äºº |
| | | /// </summary> |
| | | public string LastModifierName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¿®æ¹äºº-æ¥è¯¢å
³ç³»è¿ç®ç¬¦ |
| | | /// </summary> |
| | | public SearchFilterModeEnum LastModifierName_FilterMode { get; set; }= SearchFilterModeEnum.æ¨¡ç³æ¥è¯¢; |
| | | |
| | | /// <summary> |
| | | /// æä½å¤æ³¨ |
| | | /// </summary> |
| | | public string OperationRemark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æä½å¤æ³¨-æ¥è¯¢å
³ç³»è¿ç®ç¬¦ |
| | | /// </summary> |
| | | public SearchFilterModeEnum OperationRemark_FilterMode { get; set; }= SearchFilterModeEnum.æ¨¡ç³æ¥è¯¢; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsContainerPlace; |
| | | |
| | | /// <summary> |
| | | /// åºä½å®¹å¨å
³ç³»åå»ºåæ°å¯¹è±¡ |
| | | /// </summary> |
| | | public class WmsContainerPlaceCreateDto : WmsContainerPlaceCreateOrUpdateDtoBase |
| | | { |
| | | /// <summary> |
| | | /// æåº |
| | | /// </summary> |
| | | public virtual int? Sort { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¯å¦ç¦ç¨ |
| | | /// </summary> |
| | | public bool? IsDisabled { get; set; } = false; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using CMS.Plugin.HIAWms.Domain.Shared.Enums; |
| | | using System; |
| | | using Volo.Abp.Application.Dtos; |
| | | |
| | | namespace CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsContainerPlace; |
| | | |
| | | /// <summary> |
| | | /// åºä½å®¹å¨å
³ç³»åå»ºææ´æ°åºç±» |
| | | /// </summary> |
| | | public abstract class WmsContainerPlaceCreateOrUpdateDtoBase : ExtensibleEntityDto |
| | | { |
| | | /// <summary> |
| | | /// åºä½ç¼ç |
| | | /// </summary> |
| | | public string PlaceNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¼ç |
| | | /// </summary> |
| | | public string ContainerNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æåº |
| | | /// </summary> |
| | | public int Sort { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åç§° |
| | | /// </summary> |
| | | public DateTime BindTime { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¯å¦ç¦ç¨ |
| | | /// </summary> |
| | | public bool? IsDisabled { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | public string? Remark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å建人ID |
| | | /// </summary> |
| | | public string? CreatorId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¿®æ¹äººID |
| | | /// </summary> |
| | | public string? LastModifierId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å建人 |
| | | /// </summary> |
| | | public string? CreatorName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å é¤å¤æ³¨ |
| | | /// </summary> |
| | | public string? DeleteRemark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ©å±å段1 |
| | | /// </summary> |
| | | public string? ExtraField1 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ©å±å段2 |
| | | /// </summary> |
| | | public string? ExtraField2 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ©å±å段3 |
| | | /// </summary> |
| | | public string? ExtraField3 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¿®æ¹äºº |
| | | /// </summary> |
| | | public string? LastModifierName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æä½å¤æ³¨ |
| | | /// </summary> |
| | | public string? OperationRemark { get; set; } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// Initializes a new instance of the <see cref="WmsContainerPlaceCreateOrUpdateDtoBase"/> class. |
| | | /// </summary> |
| | | public WmsContainerPlaceCreateOrUpdateDtoBase() : base(false) |
| | | { |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using CMS.Plugin.HIAWms.Domain.Shared.Enums; |
| | | using CmsQueryExtensions; |
| | | using Volo.Abp.Application.Dtos; |
| | | using Volo.Abp.Data; |
| | | using Volo.Abp.Domain.Entities; |
| | | |
| | | |
| | | namespace CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsContainerPlace; |
| | | |
| | | /// <summary> |
| | | /// åºä½å®¹å¨å
³ç³»æ°æ®åæ°å¯¹è±¡ |
| | | /// </summary> |
| | | public class WmsContainerPlaceDto: ExtensibleEntityDto<Guid>, IHasConcurrencyStamp |
| | | { |
| | | /// <summary> |
| | | /// åºä½ç¼ç |
| | | /// </summary> |
| | | public string PlaceNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¼ç |
| | | /// </summary> |
| | | public string ContainerNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æåº |
| | | /// </summary> |
| | | public int Sort { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åç§° |
| | | /// </summary> |
| | | public DateTime BindTime { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¯å¦ç¦ç¨ |
| | | /// </summary> |
| | | public bool? IsDisabled { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | public string? Remark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ©å±å±æ§ |
| | | /// </summary> |
| | | public ExtraPropertyDictionary? ExtraProperties { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å¹¶åæ³ |
| | | /// </summary> |
| | | public string? ConcurrencyStamp { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å建æ¶é´ |
| | | /// </summary> |
| | | public DateTime CreationTime { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å建人ID |
| | | /// </summary> |
| | | public string? CreatorId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¿®æ¹æ¶é´ |
| | | /// </summary> |
| | | public DateTime? LastModificationTime { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¿®æ¹äººID |
| | | /// </summary> |
| | | public string? LastModifierId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¯å¦å é¤ |
| | | /// </summary> |
| | | public bool IsDeleted { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å é¤äººID |
| | | /// </summary> |
| | | public string? DeleterId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å 餿¶é´ |
| | | /// </summary> |
| | | public DateTime? DeletionTime { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å建人 |
| | | /// </summary> |
| | | public string? CreatorName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å é¤å¤æ³¨ |
| | | /// </summary> |
| | | public string? DeleteRemark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ©å±å段1 |
| | | /// </summary> |
| | | public string? ExtraField1 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ©å±å段2 |
| | | /// </summary> |
| | | public string? ExtraField2 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ©å±å段3 |
| | | /// </summary> |
| | | public string? ExtraField3 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¿®æ¹äºº |
| | | /// </summary> |
| | | public string? LastModifierName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æä½å¤æ³¨ |
| | | /// </summary> |
| | | public string? OperationRemark { get; set; } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// Gets the export data. |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public Dictionary<string, object> GetExportData() |
| | | { |
| | | var exportData = new Dictionary<string, object>(); |
| | | foreach (var property in this.GetType().GetProperties()) |
| | | { |
| | | exportData.Add(property.Name, property.GetValue(this)); |
| | | } |
| | | |
| | | return exportData; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using MiniExcelLibs.Attributes; |
| | | using System.ComponentModel.DataAnnotations; |
| | | using System; |
| | | using System.ComponentModel; |
| | | using CMS.Plugin.HIAWms.Domain.Shared.Enums; |
| | | namespace CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsContainerPlace; |
| | | |
| | | /// <summary> |
| | | /// åºä½å®¹å¨å
³ç³»å¯¼åºæ¨¡å |
| | | /// </summary> |
| | | public class WmsContainerPlaceExportModel |
| | | { |
| | | /// <summary> |
| | | /// åºä½ç¼ç |
| | | /// </summary> |
| | | [ExcelColumn(Name = "åºä½ç¼ç ", Width = 25)] |
| | | public string PlaceNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¼ç |
| | | /// </summary> |
| | | [ExcelColumn(Name = "ç¼ç ", Width = 25)] |
| | | public string ContainerNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æåº |
| | | /// </summary> |
| | | [ExcelColumn(Name = "æåº", Width = 25)] |
| | | public int Sort { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åç§° |
| | | /// </summary> |
| | | [ExcelColumn(Name = "åç§°", Width = 25)] |
| | | public DateTime BindTime { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¯å¦ç¦ç¨ |
| | | /// </summary> |
| | | [ExcelColumn(Name = "æ¯å¦ç¦ç¨", Width = 25)] |
| | | public bool? IsDisabled { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [ExcelColumn(Name = "夿³¨", Width = 25)] |
| | | public string Remark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å建人 |
| | | /// </summary> |
| | | [ExcelColumn(Name = "å建人", Width = 25)] |
| | | public string CreatorName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å é¤å¤æ³¨ |
| | | /// </summary> |
| | | [ExcelColumn(Name = "å é¤å¤æ³¨", Width = 25)] |
| | | public string DeleteRemark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ©å±å段1 |
| | | /// </summary> |
| | | [ExcelColumn(Name = "æ©å±å段1", Width = 25)] |
| | | public string ExtraField1 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ©å±å段2 |
| | | /// </summary> |
| | | [ExcelColumn(Name = "æ©å±å段2", Width = 25)] |
| | | public string ExtraField2 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ©å±å段3 |
| | | /// </summary> |
| | | [ExcelColumn(Name = "æ©å±å段3", Width = 25)] |
| | | public string ExtraField3 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¿®æ¹äºº |
| | | /// </summary> |
| | | [ExcelColumn(Name = "ä¿®æ¹äºº", Width = 25)] |
| | | public string LastModifierName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æä½å¤æ³¨ |
| | | /// </summary> |
| | | [ExcelColumn(Name = "æä½å¤æ³¨", Width = 25)] |
| | | public string OperationRemark { get; set; } |
| | | |
| | | |
| | | |
| | | public Dictionary<string, object> GetExportData() |
| | | { |
| | | var exportData = new Dictionary<string, object>(); |
| | | foreach (var property in this.GetType().GetProperties()) |
| | | { |
| | | exportData.Add(property.Name, property.GetValue(this)); |
| | | } |
| | | |
| | | return exportData; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Volo.Abp.Domain.Entities; |
| | | namespace CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsContainerPlace; |
| | | |
| | | /// <summary> |
| | | /// åºä½å®¹å¨å
³ç³»æ´æ°åæ°å¯¹è±¡ |
| | | /// </summary> |
| | | public class WmsContainerPlaceUpdateDto : WmsContainerPlaceCreateOrUpdateDtoBase, IHasConcurrencyStamp |
| | | { |
| | | /// <summary> |
| | | /// å¹¶åæ³ |
| | | /// </summary> |
| | | public string ConcurrencyStamp { get; set; } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | namespace CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsContainerPlace |
| | | { |
| | | /// <summary> |
| | | /// åºä½å®¹å¨å
³ç³»å¯¼å
¥æ¨¡å |
| | | /// </summary> |
| | | public class WmsContainerPlacesImportModel |
| | | { |
| | | private List<WmsContainerPlaceImportModel> _WmsContainerPlaces = new(); |
| | | |
| | | public List<WmsContainerPlaceImportModel> WmsContainerPlaces |
| | | { |
| | | get => _WmsContainerPlaces; |
| | | set |
| | | { |
| | | _WmsContainerPlaces = value; |
| | | var rowIndex = 2; |
| | | _WmsContainerPlaces?.ForEach(x => x.RowIndex = rowIndex++); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åºä½å®¹å¨å
³ç³»å¯¼å
¥æ¨¡å |
| | | /// </summary> |
| | | public class WmsContainerPlaceImportModel : WmsContainerPlaceExportModel |
| | | { |
| | | /// <summary> |
| | | /// è¡å· |
| | | /// </summary> |
| | | public int RowIndex { get; set; } |
| | | } |
| | | } |
| | | } |
| | |
| | | /// <summary> |
| | | /// æ¯å¦ç©ºæ |
| | | /// </summary> |
| | | public YesNoEnum EmptyContainer { get; protected set; } |
| | | public YesNoEnum EmptyContainer { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å
¥åºæ¶é´ |
| | |
| | | /// ç©æç¼ç ï¼å¯ä¸æ è¯ï¼ |
| | | /// </summary> |
| | | [Description("ç©æç¼ç ï¼å¯ä¸æ è¯ï¼")] |
| | | public string MaterialCode { get; set; } |
| | | public string MaterialNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æåç§° |
| | |
| | | /// <summary> |
| | | /// ç©æç¼ç ï¼å¯ä¸æ è¯ï¼ |
| | | /// </summary> |
| | | public string MaterialCode { get; set; } |
| | | public string MaterialNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æåç§° |
| | |
| | | /// <summary> |
| | | /// ç©æç¼ç ï¼å¯ä¸æ è¯ï¼ |
| | | /// </summary> |
| | | public string MaterialCode { get; set; } |
| | | public string MaterialNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æåç§° |
| | |
| | | /// <summary> |
| | | /// ç©æç¼ç ï¼å¯ä¸æ è¯ï¼ |
| | | /// </summary> |
| | | public string MaterialCode { get; set; } |
| | | public string MaterialNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æåç§° |
| | |
| | | /// </summary> |
| | | /// <example>MAT-2023-001</example> |
| | | [ExcelColumn(Name = "ç©æç¼ç ", Width = 25)] |
| | | public string MaterialCode { get; set; } |
| | | public string MaterialNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æåç§° |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsPlaces; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace CMS.Plugin.HIAWms.Application.Contracts.Services |
| | | { |
| | | public interface IWmsCommonAppService |
| | | { |
| | | /// <summary> |
| | | /// æ¥æ¾å¯ç¨åºä½ |
| | | /// </summary> |
| | | /// <param name="materialModel"></param> |
| | | /// <param name="requiredNum"></param> |
| | | /// <param name="materialNo"></param> |
| | | /// <returns></returns> |
| | | Task<Dictionary<WmsPlaceDto, int>> FindAvailablePlacesAsync(string materialModel, int requiredNum, string materialNo = ""); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsContainerPlace; |
| | | using Volo.Abp.Application.Services; |
| | | |
| | | namespace CMS.Plugin.HIAWms.Application.Contracts.Services; |
| | | |
| | | /// <summary> |
| | | /// åºä½å®¹å¨å
³ç³»åºç¨æå¡æ¥å£ |
| | | /// </summary> |
| | | public interface IWmsContainerPlaceAppService : ICrudAppService<WmsContainerPlaceDto, Guid, GetWmsContainerPlaceInput, WmsContainerPlaceCreateDto, WmsContainerPlaceUpdateDto> |
| | | { |
| | | /// <summary> |
| | | /// å
éåºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="ids"></param> |
| | | /// <returns></returns> |
| | | Task<List<WmsContainerPlaceDto>> CloneAsync(IEnumerable<Guid> ids); |
| | | |
| | | /// <summary> |
| | | /// å é¤åºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="ids"></param> |
| | | /// <returns></returns> |
| | | Task DeleteManyAsync(IEnumerable<Guid> ids); |
| | | |
| | | /// <summary> |
| | | /// è°æ´æåºåºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <param name="sort"></param> |
| | | /// <returns></returns> |
| | | Task AdjustSortAsync(Guid id, int sort); |
| | | |
| | | /// <summary> |
| | | /// 导å
¥åºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | Task ImportAsync(WmsContainerPlacesImportModel input); |
| | | |
| | | /// <summary> |
| | | /// 导åºåºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | Task<(Dictionary<string, object> Sheets, string FileName)> ExportAsync(GetWmsContainerPlaceInput input); |
| | | } |
| | |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsEnumDto; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.CommonDto; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsEnumDto; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsStores; |
| | | using CMS.Plugin.HIAWms.Domain.Shared.Enums; |
| | | using CmsQueryExtensions; |
| | | using static CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsAreas.WmsAreaCreateOrUpdateDtoBase; |
| | | using static CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsPlaces.WmsPlaceCreateOrUpdateDtoBase; |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | Task<List<PlaceAisleForListOuptut>> GetAisleListAsync(); |
| | | |
| | | |
| | | /// <summary> |
| | | /// è·åæºå |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | Task<List<MaterialModelOutput>> GetMaterialModeListAsync(); |
| | | |
| | | /// <summary> |
| | | /// è·ååºä½å表 |
| | | /// </summary> |
| | | /// <param name="placeType"></param> |
| | | /// <returns></returns> |
| | | Task<List<PlaceListOutput>> GetPlaceListForSelectAsync(PlaceTypeEnum placeType); |
| | | } |
| | | } |
| | |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.BindInstockDto; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsMaterialStocks; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsTask; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Services; |
| | | using CMS.Plugin.HIAWms.Domain.Shared.Enums; |
| | | using CMS.Plugin.HIAWms.Domain.WmsContainerPlace; |
| | | using CMS.Plugin.HIAWms.Domain.WmsContainers; |
| | | using CMS.Plugin.HIAWms.Domain.WmsMaterialContainer; |
| | | using CMS.Plugin.HIAWms.Domain.WmsMaterialInfos; |
| | | using CMS.Plugin.HIAWms.Domain.WmsMaterials; |
| | | using CMS.Plugin.HIAWms.Domain.WmsPlaces; |
| | | using CMS.Plugin.HIAWms.Domain.WmsTask; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | /// </summary> |
| | | public class WmsBindInStockAssService : CMSPluginAppService |
| | | { |
| | | public async Task BindMaterialContaienrAsync(BindMaterialInput input) |
| | | private readonly IWmsMaterialRepository _wmsMaterialRepository; |
| | | private readonly IWmsContainerRepository _wmsContainerRepository; |
| | | private readonly IWmsPlaceRepository _wmsPlaceRepository; |
| | | private readonly IWmsMaterialContainerRepository _wmsMaterialContainerRepository; |
| | | private readonly IWmsContainerPlaceRepository _wmsContainerPlaceRepository; |
| | | private readonly IWmsMaterialInfoRepository _wmsMaterialInfoRepository; |
| | | private readonly IWmsMaterialStockAppService _wmsMaterialStockAppService; |
| | | private readonly IWmsCommonAppService _wmsCommonAppService; |
| | | private readonly IWmsTaskRepository _wmsTaskRepository; |
| | | private readonly IWmsTaskAppService _wmsTaskAppService; |
| | | |
| | | public WmsBindInStockAssService(IWmsMaterialRepository wmsMaterialRepository, |
| | | IWmsContainerRepository wmsContainerRepository, |
| | | IWmsPlaceRepository wmsPlaceRepository |
| | | , |
| | | IWmsMaterialContainerRepository wmsMaterialContainerRepository, |
| | | IWmsContainerPlaceRepository wmsContainerPlaceRepository, |
| | | IWmsMaterialInfoRepository wmsMaterialInfoRepository, |
| | | IWmsMaterialStockAppService wmsMaterialStockAppService, |
| | | IWmsCommonAppService wmsCommonAppService, |
| | | IWmsTaskRepository wmsTaskRepository, |
| | | IWmsTaskAppService wmsTaskAppService) |
| | | { |
| | | _wmsMaterialRepository = wmsMaterialRepository; |
| | | _wmsContainerRepository = wmsContainerRepository; |
| | | _wmsPlaceRepository = wmsPlaceRepository; |
| | | _wmsMaterialContainerRepository = wmsMaterialContainerRepository; |
| | | _wmsContainerPlaceRepository = wmsContainerPlaceRepository; |
| | | _wmsMaterialInfoRepository = wmsMaterialInfoRepository; |
| | | _wmsMaterialStockAppService = wmsMaterialStockAppService; |
| | | _wmsCommonAppService = wmsCommonAppService; |
| | | _wmsTaskRepository = wmsTaskRepository; |
| | | _wmsTaskAppService = wmsTaskAppService; |
| | | } |
| | | |
| | | public async Task BindMaterialContaienrAsync(BindInstockInput input) |
| | | { |
| | | if (string.IsNullOrEmpty(input.MaterialModel)) { throw new UserFriendlyException("è¯·éæ©åºä½ç¼å·"); } |
| | | if (string.IsNullOrEmpty(input.MaterialBatch)) { throw new UserFriendlyException("请è¾å
¥æ¹æ¬¡å·"); } |
| | | if (input.MaterialStockNumber<=0) { throw new UserFriendlyException("å
¥åºæ°éå¿
须大äº0"); } |
| | | if (input.StockNumber <= 0) { throw new UserFriendlyException("å
¥åºæ°éå¿
须大äº0"); } |
| | | #region åºå¼ |
| | | //string containerNo = DateTime.Now.ToString("yyMMddHHmmss") + new Random(Guid.NewGuid().GetHashCode()).Next(100, 9999).ToString(); |
| | | |
| | | //// 5. å建æç |
| | | //var container = new WmsContainer |
| | | //{ |
| | | // ContainerNo = containerNo, |
| | | // ContainerType = Domain.Shared.Enums.ContainerTypeEnum.XUNI, |
| | | // ContainerStatus = Domain.Shared.Enums.ContainerStatusEnum.ZUPANG, |
| | | //}; |
| | | //await _wmsContainerRepository.InsertAsync(container); |
| | | |
| | | //var materialContainerList = new List<WmsMaterialContainer>(); |
| | | //var materialInfoList = new List<WmsMaterialInfo>(); |
| | | //for (int i = 0; i < input.MaterialStockNumber; i++) |
| | | //{ |
| | | // string materialId = Guid.NewGuid().ToString("N"); |
| | | // var materialContainer = new WmsMaterialContainer |
| | | // { |
| | | // MaterialId = materialId, |
| | | // ContainerNo = containerNo, |
| | | // }; |
| | | // materialContainerList.Add(materialContainer); |
| | | |
| | | // var materialInfo = new WmsMaterialInfo |
| | | // { |
| | | |
| | | // }; |
| | | // materialInfoList.Add(materialInfo); |
| | | //} |
| | | |
| | | //await _wmsMaterialContainerRepository.InsertManyAsync(materialContainerList); |
| | | //await _wmsMaterialInfoRepository.InsertManyAsync(materialInfoList); |
| | | #endregion |
| | | |
| | | var material = await _wmsMaterialRepository.FindByModelAsync(input.MaterialModel); |
| | | if (material == null) |
| | | { |
| | | throw new UserFriendlyException($"ç©æåå· {input.MaterialModel} ä¸åå¨ï¼"); |
| | | } |
| | | |
| | | // 5. å建æç |
| | | var containerNo = input.ContainerNo; |
| | | if (string.IsNullOrEmpty(containerNo)) |
| | | { |
| | | containerNo = DateTime.Now.ToString("yyMMddHHmmss") + new Random(Guid.NewGuid().GetHashCode()).Next(100, 9999).ToString(); |
| | | } |
| | | var container = new WmsContainer |
| | | { |
| | | ContainerNo = containerNo, |
| | | ContainerType = Domain.Shared.Enums.ContainerTypeEnum.XUNI, |
| | | ContainerStatus = Domain.Shared.Enums.ContainerStatusEnum.ZUPANG, |
| | | }; |
| | | await _wmsContainerRepository.InsertAsync(container); |
| | | |
| | | var materialStock = new WmsMaterialStockCreateDto |
| | | { |
| | | MaterialNo = material.MaterialNo, |
| | | MaterialName = material.MaterialName, |
| | | MaterialBatch = input.MaterialBatch, |
| | | StockNumber = input.StockNumber, |
| | | CheckStatus = Domain.Shared.Enums.MaterialCheckStatusEnum.HEGE, |
| | | IsLock = Domain.Shared.Enums.YesNoEnum.N, |
| | | PlaceNo = input.PlaceNo, |
| | | ContainerNo = containerNo, |
| | | EmptyContainer = Domain.Shared.Enums.YesNoEnum.N, |
| | | }; |
| | | await _wmsMaterialStockAppService.CreateAsync(materialStock); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// ç»çå
¥åº |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="UserFriendlyException"></exception> |
| | | public async Task BindInStockAsync(BindInstockInput input) |
| | | { |
| | | if(string.IsNullOrEmpty(input.PlaceNo)) { throw new UserFriendlyException("è¯·éæ©åºä½ç¼å·"); } |
| | | |
| | | var bindInput = ObjectMapper.Map<BindInstockInput, BindMaterialInput>(input); |
| | | await BindMaterialContaienrAsync(bindInput); |
| | | input.ContainerNo = DateTime.Now.ToString("yyMMddHHmmss") + new Random(Guid.NewGuid().GetHashCode()).Next(100, 9999).ToString(); |
| | | await BindMaterialContaienrAsync(input); |
| | | |
| | | // çæä»»å¡ |
| | | var plactDict = await _wmsCommonAppService.FindAvailablePlacesAsync(input.MaterialNo, input.StockNumber); |
| | | var taskList = new List<WmsTask>(); |
| | | foreach (var kvp in plactDict) |
| | | { |
| | | var place = kvp.Key; // WmsPlace对象 |
| | | var quantity = kvp.Value; // åé
æ°é |
| | | |
| | | for (int i = 0; i < quantity; i++) |
| | | { |
| | | var task = new WmsTask |
| | | { |
| | | TaskNo = $"RK_{DateTime.Now:yyyyMMddHHmmss}_{Guid.NewGuid().ToString("N").Substring(0, 6)}", |
| | | ContainerNo = input.ContainerNo, |
| | | SourcePlace = input.PlaceNo, |
| | | ToPlace = place.PlaceNo, |
| | | TaskType = TaskTypeEnum.RUKU, |
| | | SonTaskType = SonTaskTypeEnum.RGRUKU, |
| | | TaskStatus = WmsTaskStatus.WEIZHIXING, |
| | | TaskLevel = 999, |
| | | Aisle = 1, |
| | | DodeviceId = 0, |
| | | TaskDodeviceStatus = TaskDodeviceStatus.SrmNoStart, |
| | | IsNextTask = (int)YesNoEnum.Y, |
| | | IsRead = true, |
| | | MutableParam1 = input.MaterialModel, |
| | | }; |
| | | taskList.Add(task); |
| | | } |
| | | } |
| | | await _wmsTaskRepository.InsertManyAsync(taskList); |
| | | } |
| | | } |
| | | } |
| | |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.CommonDto; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsPlaces; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Services; |
| | | using CMS.Plugin.HIAWms.Domain.WmsMaterials; |
| | | using CMS.Plugin.HIAWms.Domain.WmsMaterialStocks; |
| | | using CMS.Plugin.HIAWms.Domain.WmsPlaces; |
| | |
| | | /// <summary> |
| | | /// å
Œ
±æä½æå¡ |
| | | /// </summary> |
| | | public class WmsCommonAppService : CMSPluginAppService |
| | | public class WmsCommonAppService : CMSPluginAppService,IWmsCommonAppService |
| | | { |
| | | private readonly IWmsMaterialRepository _wmsMaterialRepository; |
| | | private readonly IWmsPlaceRepository _wmsPlaceRepository; |
| | |
| | | _wmsMaterialStockRepository = wmsMaterialStockRepository; |
| | | } |
| | | |
| | | public async Task<List<MaterialModelOutput>> GetMaterialModeListAsync() |
| | | { |
| | | var materialList = await _wmsMaterialRepository.GetMaterialListAsync(new WmsMaterial()); |
| | | if (materialList == null || materialList.Count <= 0) return new List<MaterialModelOutput>(); ; |
| | | |
| | | return materialList.Select(material => new MaterialModelOutput |
| | | { |
| | | MaterialModel = material.MaterialModel, |
| | | MaterialModelDesc = material.MaterialModel |
| | | }).ToList(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¥æ¾ç©ºåºä½ |
| | |
| | | /// <param name="requiredNum"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="UserFriendlyException"></exception> |
| | | public async Task<Dictionary<WmsPlace, int>> FindAvailablePlacesAsync(string materialModel, string materialNo, int requiredNum) |
| | | public async Task<Dictionary<WmsPlaceDto, int>> FindAvailablePlacesAsync(string materialModel,int requiredNum, string materialNo="" ) |
| | | { |
| | | // 1. è·åææåºåååºä½ä¿¡æ¯ |
| | | var stockList = await _wmsMaterialStockRepository.GetListAsync(new WmsMaterialStock()); |
| | | var allPlaceList = await _wmsPlaceRepository.GetListAsync(new WmsPlace()); |
| | | |
| | | var allPlaceList = ObjectMapper.Map<List<WmsPlace>, List<WmsPlaceDto>>(await _wmsPlaceRepository.GetListAsync(new WmsPlace())); |
| | | |
| | | // 2. æ¥æ¾ç¸åç©æåå·åç¼å·çåºåï¼æåºåééåºï¼ |
| | | var sameModelStocks = stockList |
| | |
| | | .OrderByDescending(x => x.StockNumber) |
| | | .ToList(); |
| | | |
| | | var availablePlaces = new Dictionary<WmsPlace, int>(); |
| | | var availablePlaces = new Dictionary<WmsPlaceDto, int>(); |
| | | int remainingNum = requiredNum; |
| | | |
| | | // 3. ä¼å
æ£æ¥å·²æåºåçåºä½æ¯å¦è½åæ¾ï¼ç¸å MaterialNoï¼ |
| | |
| | | |
| | | return availablePlaces; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¥æ¾åºå |
| | | /// </summary> |
| | | /// <param name="materialModel"></param> |
| | | /// <param name="requiredNum"></param> |
| | | /// <param name="materialNo"></param> |
| | | /// <returns></returns> |
| | | public async Task<Dictionary<string, int>> FindStockAsync(string materialModel, int requiredNum, string materialNo = "") |
| | | { |
| | | // 1. è·åææåºåï¼æé¤éå®åºåï¼ |
| | | var stockList = (await _wmsMaterialStockRepository.GetListAsync(new WmsMaterialStock())) |
| | | .Where(x => x.IsLock == Domain.Shared.Enums.YesNoEnum.N) |
| | | .ToList(); |
| | | |
| | | // 2. çéå¹é
ç©æ |
| | | var availableStocks = stockList |
| | | .Where(x => x.MaterialModel == materialModel) |
| | | .WhereIf(!string.IsNullOrEmpty(materialNo), x => x.MaterialNo == materialNo) |
| | | .OrderBy(x => x.StockNumber) // ä¼å
ä»åºåå°çåºä½åº |
| | | .ToList(); |
| | | |
| | | // 3. æ£æ¥æ»åºåæ¯å¦è¶³å¤ |
| | | int totalAvailable = availableStocks.Sum(x => x.StockNumber); |
| | | if (totalAvailable < requiredNum) |
| | | { |
| | | throw new UserFriendlyException( |
| | | $"åºåä¸è¶³ï¼éæ±: {requiredNum}, å¯ç¨: {totalAvailable}, 缺: {requiredNum - totalAvailable}"); |
| | | } |
| | | |
| | | // 4. 计ç®ååºä½åºåºæ°é |
| | | var allocation = new Dictionary<string, int>(); // <åºä½å·, åºåºæ°> |
| | | int remaining = requiredNum; |
| | | |
| | | foreach (var stock in availableStocks) |
| | | { |
| | | if (remaining <= 0) break; |
| | | |
| | | int deductAmount = Math.Min(stock.StockNumber, remaining); |
| | | allocation.Add(stock.PlaceNo, deductAmount); |
| | | remaining -= deductAmount; |
| | | } |
| | | |
| | | return allocation; |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsContainerPlace; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Services; |
| | | using CMS.Plugin.HIAWms.Domain.Shared; |
| | | using CmsQueryExtensions; |
| | | using CMS.Plugin.HIAWms.Domain.WmsContainerPlace; |
| | | using CmsQueryExtensions.Extension; |
| | | using System.Linq.Expressions; |
| | | using Volo.Abp; |
| | | using Volo.Abp.Application.Dtos; |
| | | using Volo.Abp.Data; |
| | | using Volo.Abp.ObjectExtending; |
| | | using Volo.Abp.ObjectMapping; |
| | | |
| | | namespace CMS.Plugin.HIAWms.Application.Implements; |
| | | |
| | | /// <summary> |
| | | /// åºä½å®¹å¨å
³ç³»åºç¨æå¡ |
| | | /// </summary> |
| | | public class WmsContainerPlaceAppService : CMSPluginAppService, IWmsContainerPlaceAppService |
| | | { |
| | | private readonly IWmsContainerPlaceRepository wmsContainerPlaceRepository; |
| | | |
| | | /// <summary> |
| | | /// Initializes a new instance of the <see cref="WmsContainerPlaceAppService"/> class. |
| | | /// </summary> |
| | | /// <param name="WmsContainerPlaceRepository">The task job repository.</param> |
| | | public WmsContainerPlaceAppService(IWmsContainerPlaceRepository _WmsContainerPlaceRepository) |
| | | { |
| | | wmsContainerPlaceRepository = _WmsContainerPlaceRepository; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åæå®åºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <returns></returns> |
| | | public virtual async Task<WmsContainerPlaceDto> GetAsync(Guid id) |
| | | { |
| | | return ObjectMapper.Map<WmsContainerPlace, WmsContainerPlaceDto>(await wmsContainerPlaceRepository.GetAsync(id)); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å页è·ååºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | public virtual async Task<PagedResultDto<WmsContainerPlaceDto>> GetListAsync(GetWmsContainerPlaceInput input) |
| | | { |
| | | Check.NotNull(input, nameof(input)); |
| | | |
| | | if (input.Sorting.IsNullOrWhiteSpace()) |
| | | { |
| | | input.Sorting = nameof(WmsContainerPlace.Sort); |
| | | } |
| | | |
| | | #region 卿æé æ¥è¯¢æ¡ä»¶ |
| | | |
| | | //卿æé æ¥è¯¢æ¡ä»¶ |
| | | var whereConditions = DynamicGetQueryParams(input); |
| | | |
| | | #endregion |
| | | |
| | | var count = await wmsContainerPlaceRepository.GetCountAsync(whereConditions); |
| | | var list = await wmsContainerPlaceRepository.GetListAsync(whereConditions, input.Sorting, input.MaxResultCount, input.SkipCount); |
| | | |
| | | return new PagedResultDto<WmsContainerPlaceDto>(count, ObjectMapper.Map<List<WmsContainerPlace>, List<WmsContainerPlaceDto>>(list)); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 卿æé æ¥è¯¢æ¡ä»¶ |
| | | /// </summary> |
| | | /// <param name="input">è¾å
¥åæ°</param> |
| | | /// <returns></returns> |
| | | private FunReturnResultModel<Expression<Func<WmsContainerPlace, bool>>> DynamicGetQueryParams(GetWmsContainerPlaceInput input) |
| | | { |
| | | //卿æé æ¥è¯¢æ¡ä»¶ |
| | | var whereConditions = WhereConditionsExtensions.GetWhereConditions<WmsContainerPlace, GetWmsContainerPlaceInput>(input); |
| | | if (!whereConditions.IsSuccess) |
| | | { |
| | | throw new Exception("卿æé æ¥è¯¢æ¡ä»¶å¤±è´¥:" + whereConditions.ErrMsg); |
| | | } |
| | | |
| | | //ä¹å¯å次èªå®ä¹æå»ºæ¥è¯¢æ¡ä»¶ |
| | | Expression<Func<WmsContainerPlace, bool>> extendExpression = a => a.IsDeleted == false; |
| | | // ä½¿ç¨ System.Linq.PredicateBuilder ç And |
| | | var pres = (System.Linq.Expressions.Expression<Func<WmsContainerPlace, bool>>)(whereConditions.data); |
| | | whereConditions.data = System.Linq.PredicateBuilder.And(pres, extendExpression); |
| | | |
| | | return whereConditions; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ°å»ºåºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="UserFriendlyException"></exception> |
| | | public virtual async Task<WmsContainerPlaceDto> CreateAsync(WmsContainerPlaceCreateDto input) |
| | | { |
| | | await CheckCreateOrUpdateDtoAsync(input); |
| | | |
| | | var exist = await wmsContainerPlaceRepository.NameExistAsync(input.PlaceNo); |
| | | if (exist) |
| | | { |
| | | throw new UserFriendlyException(L[CMSPluginDomainErrorCodes.NameAlreadyExists, input.PlaceNo]); |
| | | } |
| | | |
| | | var maxSort = await wmsContainerPlaceRepository.GetMaxSortAsync(); |
| | | var sort = input.Sort ?? maxSort; |
| | | |
| | | var insertObj = ObjectMapper.Map<WmsContainerPlaceCreateDto, WmsContainerPlace>(input); |
| | | insertObj.Sort = sort; |
| | | input.MapExtraPropertiesTo(insertObj, MappingPropertyDefinitionChecks.None); |
| | | |
| | | await wmsContainerPlaceRepository.InsertAsync(insertObj); |
| | | |
| | | //if (input.Sort.HasValue && insertObj.Sort != maxSort) |
| | | //{ |
| | | // await AdjustSortAsync(insertObj.Id, insertObj.Sort); |
| | | //} |
| | | |
| | | return ObjectMapper.Map<WmsContainerPlace, WmsContainerPlaceDto>(insertObj); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°åºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="UserFriendlyException"></exception> |
| | | public virtual async Task<WmsContainerPlaceDto> UpdateAsync(Guid id, WmsContainerPlaceUpdateDto input) |
| | | { |
| | | await CheckCreateOrUpdateDtoAsync(input); |
| | | |
| | | var updateObj = await wmsContainerPlaceRepository.GetAsync(id); |
| | | var exist = await wmsContainerPlaceRepository.NameExistAsync(input.PlaceNo, updateObj.Id); |
| | | if (exist) |
| | | { |
| | | throw new UserFriendlyException(L[CMSPluginDomainErrorCodes.NameAlreadyExists, input.PlaceNo]); |
| | | } |
| | | |
| | | updateObj.SetConcurrencyStampIfNotNull(input.ConcurrencyStamp); |
| | | input.MapExtraPropertiesTo(updateObj, MappingPropertyDefinitionChecks.None); |
| | | |
| | | updateObj.PlaceNo = input.PlaceNo; |
| | | updateObj.ContainerNo = input.ContainerNo; |
| | | updateObj.IsDisabled = input.IsDisabled; |
| | | updateObj.Remark = input.Remark; |
| | | updateObj.CreatorName = input.CreatorName; |
| | | updateObj.DeleteRemark = input.DeleteRemark; |
| | | updateObj.ExtraField1 = input.ExtraField1; |
| | | updateObj.ExtraField2 = input.ExtraField2; |
| | | updateObj.ExtraField3 = input.ExtraField3; |
| | | updateObj.LastModifierName = input.LastModifierName; |
| | | updateObj.OperationRemark = input.OperationRemark; |
| | | |
| | | |
| | | await wmsContainerPlaceRepository.UpdateAsync(updateObj); |
| | | |
| | | return ObjectMapper.Map<WmsContainerPlace, WmsContainerPlaceDto>(updateObj); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å
éåºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="ids"></param> |
| | | /// <returns></returns> |
| | | public async Task<List<WmsContainerPlaceDto>> CloneAsync(IEnumerable<Guid> ids) |
| | | { |
| | | //var wmsContainerPlaces = new List<WmsContainerPlace>(); |
| | | //if (ids != null) |
| | | //{ |
| | | // var sort = await wmsContainerPlaceRepository.GetMaxSortAsync(); |
| | | // foreach (var id in ids) |
| | | // { |
| | | // var WmsContainerPlace = await wmsContainerPlaceRepository.FindAsync(id); |
| | | // if (WmsContainerPlace != null) |
| | | // { |
| | | // var name = WmsContainerPlace.Name + WmsContainerPlaceConsts.CloneTag; |
| | | // var notExist = false; |
| | | // while (!notExist) |
| | | // { |
| | | // var exist = await wmsContainerPlaceRepository.NameExistAsync(name); |
| | | // if (exist || wmsContainerPlaces.Any(x => x.Name == name)) |
| | | // { |
| | | // name += WmsContainerPlaceConsts.CloneTag; |
| | | // continue; |
| | | // } |
| | | |
| | | // notExist = true; |
| | | // } |
| | | |
| | | // //WmsContainerPlace = await wmsContainerPlaceRepository.InsertAsync(WmsContainerPlace.Clone(GuidGenerator.Create(), name, sort++)); |
| | | // wmsContainerPlaces.Add(WmsContainerPlace); |
| | | // } |
| | | // } |
| | | //} |
| | | |
| | | //return ObjectMapper.Map<List<WmsContainerPlace>, List<WmsContainerPlaceDto>>(wmsContainerPlaces); |
| | | return new List<WmsContainerPlaceDto>(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å é¤å个åºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <returns></returns> |
| | | public virtual Task DeleteAsync(Guid id) |
| | | { |
| | | return wmsContainerPlaceRepository.DeleteAsync(id); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å é¤å¤ä¸ªåºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="ids"></param> |
| | | /// <returns></returns> |
| | | public async Task DeleteManyAsync(IEnumerable<Guid> ids) |
| | | { |
| | | foreach (var id in ids) |
| | | { |
| | | await DeleteAsync(id); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è°æ´æåºåºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <param name="sort"></param> |
| | | /// <returns></returns> |
| | | public virtual async Task AdjustSortAsync(Guid id, int sort) |
| | | { |
| | | var list = await wmsContainerPlaceRepository.GetListAsync(null, nameof(WmsContainerPlace.Sort)); |
| | | if (list != null && list.Any()) |
| | | { |
| | | var initSort = 1; |
| | | list.ForEach(x => x.AdjustSort(initSort++)); |
| | | var entity = list.FirstOrDefault(x => x.Id == id); |
| | | if (entity != null) |
| | | { |
| | | if (sort == 1) |
| | | { |
| | | list.Where(x => x.Id != id).ToList()?.ForEach(x => x.AdjustSort(x.Sort + 1)); |
| | | } |
| | | else if (entity.Sort > sort) |
| | | { |
| | | list.Where(x => x.Id != id && x.Sort >= sort).ToList()?.ForEach(x => x.AdjustSort(x.Sort + 1)); |
| | | list.Where(x => x.Id != id && x.Sort < sort).ToList()?.ForEach(x => x.AdjustSort(x.Sort - 1)); |
| | | } |
| | | else if (entity.Sort < sort) |
| | | { |
| | | list.Where(x => x.Id != id && x.Sort > sort).ToList()?.ForEach(x => x.AdjustSort(x.Sort + 1)); |
| | | list.Where(x => x.Id != id && x.Sort <= sort).ToList()?.ForEach(x => x.AdjustSort(x.Sort - 1)); |
| | | } |
| | | |
| | | entity.AdjustSort(sort); |
| | | } |
| | | } |
| | | |
| | | await wmsContainerPlaceRepository.UpdateManyAsync(list); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 导å
¥åºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="UserFriendlyException"></exception> |
| | | public async Task ImportAsync(WmsContainerPlacesImportModel input) |
| | | { |
| | | Check.NotNull(input, nameof(input)); |
| | | |
| | | var wmsContainerPlaceCreateDtos = new List<(int RowIndex, WmsContainerPlaceCreateDto Item)>(); |
| | | var wmsContainerPlaceUpdateDtos = new List<(int RowIndex, Guid Id, WmsContainerPlaceUpdateDto Item)>(); |
| | | var importItems = input.WmsContainerPlaces; |
| | | |
| | | if (importItems != null && importItems.Any()) |
| | | { |
| | | #region 导å
¥æ ¡éª |
| | | |
| | | // 夿åç§°æ¯å¦éå¤ï¼å¹¶è¾åºç¬¬å è¡éå¤ |
| | | var duplicateWmsContainerPlaces = importItems.GroupBy(x => x.PlaceNo).Where(x => x.Count() > 1).ToList(); |
| | | if (duplicateWmsContainerPlaces?.Any() == true) |
| | | { |
| | | var duplicateWmsContainerPlaceMsgs = duplicateWmsContainerPlaces.Select(x => $"第 {string.Join(",", x.Select(x => x.RowIndex))} è¡ï¼{x.Key} åç§°éå¤"); |
| | | var errorMsg = $"导å
¥å¤±è´¥ï¼é
ç½®ï¼ {string.Join(",", duplicateWmsContainerPlaceMsgs)}ï¼ç»æ¢å¯¼å
¥"; |
| | | throw new UserFriendlyException(errorMsg); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | foreach (var impItem in importItems) |
| | | { |
| | | if (impItem.PlaceNo.IsNullOrWhiteSpace()) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | if (impItem.PlaceNo.IsNullOrWhiteSpace()) |
| | | { |
| | | var errorMsg = $"导å
¥å¤±è´¥ï¼é
ç½®ï¼ç¬¬{impItem.RowIndex}è¡ï¼WmsContainerPlaceåç§°ä¸è½ä¸ºç©º"; |
| | | throw new UserFriendlyException(errorMsg); |
| | | } |
| | | |
| | | var oldWmsContainerPlace = await wmsContainerPlaceRepository.FindByNameAsync(impItem.PlaceNo); |
| | | if (oldWmsContainerPlace != null) |
| | | { |
| | | var wmsContainerPlaceUpdateDto = new WmsContainerPlaceUpdateDto |
| | | { |
| | | PlaceNo = impItem.PlaceNo, |
| | | ContainerNo = impItem.ContainerNo, |
| | | BindTime = impItem.BindTime, |
| | | IsDisabled = impItem.IsDisabled, |
| | | Remark = impItem.Remark, |
| | | CreatorName = impItem.CreatorName, |
| | | DeleteRemark = impItem.DeleteRemark, |
| | | ExtraField1 = impItem.ExtraField1, |
| | | ExtraField2 = impItem.ExtraField2, |
| | | ExtraField3 = impItem.ExtraField3, |
| | | LastModifierName = impItem.LastModifierName, |
| | | OperationRemark = impItem.OperationRemark, |
| | | |
| | | }; |
| | | |
| | | wmsContainerPlaceUpdateDtos.Add((impItem.RowIndex, oldWmsContainerPlace.Id, wmsContainerPlaceUpdateDto)); |
| | | } |
| | | else |
| | | { |
| | | var wmsContainerPlaceCreateDto = new WmsContainerPlaceCreateDto |
| | | { |
| | | PlaceNo = impItem.PlaceNo, |
| | | ContainerNo = impItem.ContainerNo, |
| | | BindTime = impItem.BindTime, |
| | | IsDisabled = impItem.IsDisabled, |
| | | Remark = impItem.Remark, |
| | | CreatorName = impItem.CreatorName, |
| | | DeleteRemark = impItem.DeleteRemark, |
| | | ExtraField1 = impItem.ExtraField1, |
| | | ExtraField2 = impItem.ExtraField2, |
| | | ExtraField3 = impItem.ExtraField3, |
| | | LastModifierName = impItem.LastModifierName, |
| | | OperationRemark = impItem.OperationRemark, |
| | | |
| | | }; |
| | | |
| | | wmsContainerPlaceCreateDtos.Add((impItem.RowIndex, wmsContainerPlaceCreateDto)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // æ°å¢ |
| | | foreach (var wmsContainerPlaceDto in wmsContainerPlaceCreateDtos) |
| | | { |
| | | try |
| | | { |
| | | await CreateAsync(wmsContainerPlaceDto.Item); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | var errorMsg = $"导å
¥å¤±è´¥ï¼é
ç½®ï¼ç¬¬{wmsContainerPlaceDto.RowIndex}è¡ï¼{e.Message}ï¼ç»æ¢å¯¼å
¥"; |
| | | throw new UserFriendlyException(errorMsg); |
| | | } |
| | | } |
| | | |
| | | // æ´æ° |
| | | foreach (var wmsContainerPlaceDto in wmsContainerPlaceUpdateDtos) |
| | | { |
| | | try |
| | | { |
| | | await UpdateAsync(wmsContainerPlaceDto.Id, wmsContainerPlaceDto.Item); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | var errorMsg = $"导å
¥å¤±è´¥ï¼é
ç½®ï¼ç¬¬{wmsContainerPlaceDto.RowIndex}è¡ï¼{e.Message}ï¼ç»æ¢å¯¼å
¥"; |
| | | throw new UserFriendlyException(errorMsg); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 导åºåºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | public async Task<(Dictionary<string, object> Sheets, string FileName)> ExportAsync(GetWmsContainerPlaceInput input) |
| | | { |
| | | Check.NotNull(input, nameof(input)); |
| | | |
| | | if (input.Sorting.IsNullOrWhiteSpace()) |
| | | { |
| | | input.Sorting = nameof(WmsContainerPlace.Sort); |
| | | } |
| | | |
| | | #region 卿æé æ¥è¯¢æ¡ä»¶ |
| | | |
| | | //卿æé æ¥è¯¢æ¡ä»¶ |
| | | var whereConditions = DynamicGetQueryParams(input); |
| | | |
| | | #endregion |
| | | |
| | | |
| | | var list = await wmsContainerPlaceRepository.GetListAsync(whereConditions, input.Sorting, input.MaxResultCount, input.SkipCount, includeDetails: true); |
| | | var result = ObjectMapper.Map<List<WmsContainerPlace>, List<WmsContainerPlaceDto>>(list); |
| | | |
| | | var sheets = new Dictionary<string, object> |
| | | { |
| | | ["é
ç½®"] = ExportHelper.ConvertListToExportData(result), |
| | | }; |
| | | |
| | | var fileName = result.Count > 1 ? "åºä½å®¹å¨å
³ç³»å表" : result.Count == 1 ? result[0]?.PlaceNo : "WmsContainerPlace模ç"; |
| | | return (sheets, fileName); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ ¡éªåºä½å®¹å¨å
³ç³»ï¼å½æ°å»ºææ´æ°æ¶ |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | protected Task CheckCreateOrUpdateDtoAsync(WmsContainerPlaceCreateOrUpdateDtoBase input) |
| | | { |
| | | Check.NotNull(input, nameof(input)); |
| | | Check.NotNullOrWhiteSpace(input.PlaceNo, "åºä½ç¼ç ", 50); |
| | | Check.NotNullOrWhiteSpace(input.ContainerNo, "ç¼ç ", 64); |
| | | Check.NotNull(input.BindTime, "åç§°"); |
| | | |
| | | return Task.CompletedTask; |
| | | } |
| | | } |
| | |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsEnumDto; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.CommonDto; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsEnumDto; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsStores; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Services; |
| | | using CMS.Plugin.HIAWms.Domain.Shared.Enums; |
| | | using CMS.Plugin.HIAWms.Domain.WmsAreas; |
| | | using CMS.Plugin.HIAWms.Domain.WmsMaterials; |
| | | using CMS.Plugin.HIAWms.Domain.WmsPlaces; |
| | | using CMS.Plugin.HIAWms.Domain.WmsStores; |
| | | using CmsQueryExtensions; |
| | |
| | | private readonly IWmsStoreRepository _storeRepository; |
| | | private readonly IWmsAreaRepository _wmsAreaRepository; |
| | | private readonly IWmsPlaceRepository _wmsPlaceRepository; |
| | | private readonly IWmsMaterialRepository _wmsMaterialRepository; |
| | | |
| | | public WmsEnumAppService(IWmsStoreRepository storeRepository, IWmsAreaRepository wmsAreaRepository, IWmsPlaceRepository wmsPlaceRepository) |
| | | public WmsEnumAppService(IWmsStoreRepository storeRepository, IWmsAreaRepository wmsAreaRepository, IWmsPlaceRepository wmsPlaceRepository, IWmsMaterialRepository wmsMaterialRepository) |
| | | { |
| | | _storeRepository = storeRepository; |
| | | _wmsAreaRepository = wmsAreaRepository; |
| | | _wmsPlaceRepository = wmsPlaceRepository; |
| | | _wmsMaterialRepository = wmsMaterialRepository; |
| | | } |
| | | |
| | | public List<EnumItem> GetEnumDataList(WmsEnumInput enumInput) |
| | |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åæºå |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public async Task<List<MaterialModelOutput>> GetMaterialModeListAsync() |
| | | { |
| | | var materialList = await _wmsMaterialRepository.GetMaterialListAsync(new WmsMaterial()); |
| | | if (materialList == null || materialList.Count <= 0) return new List<MaterialModelOutput>(); ; |
| | | |
| | | return materialList.Select(material => new MaterialModelOutput |
| | | { |
| | | MaterialModel = material.MaterialModel, |
| | | MaterialModelDesc = material.MaterialModel |
| | | }).ToList(); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// è·ååºåºå表 |
| | | /// </summary> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public async Task<List<PlaceListOutput>> GetPlaceListForSelectAsync(PlaceTypeEnum placeType) |
| | | { |
| | | var placeList = await _wmsPlaceRepository.GetPlaceListForSelectAsync(placeType); |
| | | if (placeList == null || placeList.Count <= 0) return new List<PlaceListOutput>(); ; |
| | | |
| | | return placeList.Select(place => new PlaceListOutput |
| | | { |
| | | PlaceNo = place.PlaceNo, |
| | | PlaceNoDesc = place.PlaceNo |
| | | }).ToList(); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | await CheckCreateOrUpdateDtoAsync(input); |
| | | |
| | | var exist = await _wmsmaterialRepository.NameExistAsync(input.MaterialCode); |
| | | var exist = await _wmsmaterialRepository.NameExistAsync(input.MaterialNo); |
| | | if (exist) |
| | | { |
| | | throw new UserFriendlyException(L[CMSPluginDomainErrorCodes.NameAlreadyExists, input.MaterialCode]); |
| | | throw new UserFriendlyException(L[CMSPluginDomainErrorCodes.NameAlreadyExists, input.MaterialNo]); |
| | | } |
| | | |
| | | var maxSort = await _wmsmaterialRepository.GetMaxSortAsync(); |
| | |
| | | await CheckCreateOrUpdateDtoAsync(input); |
| | | |
| | | var wmsmaterial = await _wmsmaterialRepository.GetAsync(id); |
| | | var exist = await _wmsmaterialRepository.NameExistAsync(input.MaterialCode, wmsmaterial.Id); |
| | | var exist = await _wmsmaterialRepository.NameExistAsync(input.MaterialNo, wmsmaterial.Id); |
| | | if (exist) |
| | | { |
| | | throw new UserFriendlyException(L[CMSPluginDomainErrorCodes.NameAlreadyExists, input.MaterialCode]); |
| | | throw new UserFriendlyException(L[CMSPluginDomainErrorCodes.NameAlreadyExists, input.MaterialNo]); |
| | | } |
| | | |
| | | wmsmaterial.SetConcurrencyStampIfNotNull(input.ConcurrencyStamp); |
| | |
| | | #region 导å
¥æ ¡éª |
| | | |
| | | // 夿åç§°æ¯å¦éå¤ï¼å¹¶è¾åºç¬¬å è¡éå¤ |
| | | var duplicateWmsMaterials = wmsmaterials.GroupBy(x => x.MaterialCode).Where(x => x.Count() > 1).ToList(); |
| | | var duplicateWmsMaterials = wmsmaterials.GroupBy(x => x.MaterialNo).Where(x => x.Count() > 1).ToList(); |
| | | if (duplicateWmsMaterials?.Any() == true) |
| | | { |
| | | var duplicateWmsMaterialMsgs = duplicateWmsMaterials.Select(x => $"第 {string.Join(",", x.Select(x => x.RowIndex))} è¡ï¼{x.Key} åç§°éå¤"); |
| | |
| | | |
| | | foreach (var wmsmaterial in wmsmaterials) |
| | | { |
| | | if (wmsmaterial.MaterialCode.IsNullOrWhiteSpace() && wmsmaterial.MaterialName.IsNullOrWhiteSpace()) |
| | | if (wmsmaterial.MaterialNo.IsNullOrWhiteSpace() && wmsmaterial.MaterialName.IsNullOrWhiteSpace()) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | if (wmsmaterial.MaterialCode.IsNullOrWhiteSpace()) |
| | | if (wmsmaterial.MaterialNo.IsNullOrWhiteSpace()) |
| | | { |
| | | var errorMsg = $"导å
¥å¤±è´¥ï¼é
ç½®ï¼ç¬¬{wmsmaterial.RowIndex}è¡ï¼WmsMaterialåç§°ä¸è½ä¸ºç©º"; |
| | | throw new UserFriendlyException(errorMsg); |
| | | } |
| | | |
| | | var oldWmsMaterial = await _wmsmaterialRepository.FindByNameAsync(wmsmaterial.MaterialCode); |
| | | var oldWmsMaterial = await _wmsmaterialRepository.FindByNameAsync(wmsmaterial.MaterialNo); |
| | | if (oldWmsMaterial != null) |
| | | { |
| | | var wmsmaterialUpdateDto = new WmsMaterialUpdateDto |
| | | { |
| | | MaterialCode = wmsmaterial.MaterialCode, |
| | | MaterialNo = wmsmaterial.MaterialNo, |
| | | MaterialName = wmsmaterial.MaterialName, |
| | | PurchaseType = wmsmaterial.PurchaseType, |
| | | MaterialType = wmsmaterial.MaterialType, |
| | |
| | | { |
| | | var wmsmaterialCreateDto = new WmsMaterialCreateDto |
| | | { |
| | | MaterialCode = wmsmaterial.MaterialCode, |
| | | MaterialNo = wmsmaterial.MaterialNo, |
| | | MaterialName = wmsmaterial.MaterialName, |
| | | PurchaseType = wmsmaterial.PurchaseType, |
| | | MaterialType = wmsmaterial.MaterialType, |
| | |
| | | ["é
ç½®"] = ExportHelper.ConvertListToExportData(result), |
| | | }; |
| | | |
| | | var fileName = result.Count > 1 ? "WmsMaterialå表" : result.Count == 1 ? result[0]?.MaterialCode : "WmsMaterial模ç"; |
| | | var fileName = result.Count > 1 ? "WmsMaterialå表" : result.Count == 1 ? result[0]?.MaterialNo : "WmsMaterial模ç"; |
| | | return (sheets, fileName); |
| | | } |
| | | |
| | |
| | | protected Task CheckCreateOrUpdateDtoAsync(WmsMaterialCreateOrUpdateDtoBase input) |
| | | { |
| | | Check.NotNull(input, nameof(input)); |
| | | Check.NotNullOrWhiteSpace(input.MaterialCode, "ç¼å·", WmsMaterialConsts.MaxCodeLength); |
| | | Check.NotNullOrWhiteSpace(input.MaterialNo, "ç¼å·", WmsMaterialConsts.MaxCodeLength); |
| | | Check.NotNullOrWhiteSpace(input.MaterialName, "åç§°", WmsMaterialConsts.MaxNameLength); |
| | | Check.Length(input.Remark, "夿³¨", WmsMaterialConsts.MaxRemarkLength); |
| | | return Task.CompletedTask; |
| | |
| | | { |
| | | throw new UserFriendlyException("æçä¿¡æ¯ä¸åå¨"); |
| | | } |
| | | |
| | | var wmsmaterialstock = ObjectMapper.Map<WmsMaterialStockCreateDto, WmsMaterialStock>(input); |
| | | input.MapExtraPropertiesTo(wmsmaterialstock, MappingPropertyDefinitionChecks.None); |
| | | wmsmaterialstock.MaterialId = Guid.NewGuid().ToString("N"); |
| | | wmsmaterialstock.MaterialName = material.MaterialName; |
| | | |
| | | wmsmaterialstock.ContainerStatus = Domain.Shared.Enums.ContainerStatusEnum.KUWEI; |
| | | wmsmaterialstock.ContainerType = container.ContainerType; |
| | | wmsmaterialstock.StorageTypeNo = Domain.Shared.Enums.PlaceTypeEnum.XUNIKUWEI; |
| | | wmsmaterialstock.PlaceStatus = Domain.Shared.Enums.PlaceStatusEnum.DAIRU; |
| | | if (!string.IsNullOrEmpty(input.PlaceNo)) |
| | | { |
| | | var place = await _wmsplaceRepository.FindByNameAsync(input.PlaceNo); |
| | | if(place == null) |
| | | { |
| | |
| | | if(area == null) |
| | | { |
| | | throw new UserFriendlyException("åºä½åºåºä¿¡æ¯ä¸åå¨"); |
| | | } |
| | | |
| | | wmsmaterialstock.PlaceStatus = Domain.Shared.Enums.PlaceStatusEnum.CUNHUO; |
| | | wmsmaterialstock.StorageTypeNo = place.StorageTypeNo; |
| | | wmsmaterialstock.AreaCode = place.AreaCode; |
| | | wmsmaterialstock.AreaName = area.AreaName; |
| | | |
| | | place.PlaceStatus = Domain.Shared.Enums.PlaceStatusEnum.CUNHUO; |
| | | place.Islock = input.IsLock; |
| | | |
| | | await _wmsplaceRepository.UpdateAsync(place); |
| | | } |
| | | var wmsmaterialstockList = await _wmsmaterialstockRepository.GetStockListAsync(new WmsMaterialStock { PlaceNo = input.PlaceNo }); |
| | | if (wmsmaterialstockList.Count > 0) |
| | |
| | | |
| | | var maxSort = await _wmsmaterialstockRepository.GetMaxSortAsync(); |
| | | var sort = input.Sort ?? maxSort; |
| | | var wmsmaterialstock = ObjectMapper.Map<WmsMaterialStockCreateDto, WmsMaterialStock>(input); |
| | | input.MapExtraPropertiesTo(wmsmaterialstock, MappingPropertyDefinitionChecks.None); |
| | | wmsmaterialstock.MaterialId = Guid.NewGuid().ToString("N"); |
| | | wmsmaterialstock.MaterialName = material.MaterialName; |
| | | |
| | | wmsmaterialstock.ContainerStatus = Domain.Shared.Enums.ContainerStatusEnum.KUWEI; |
| | | wmsmaterialstock.ContainerType = container.ContainerType; |
| | | |
| | | wmsmaterialstock.PlaceStatus = Domain.Shared.Enums.PlaceStatusEnum.CUNHUO; |
| | | wmsmaterialstock.StorageTypeNo = place.StorageTypeNo; |
| | | wmsmaterialstock.AreaCode = place.AreaCode; |
| | | wmsmaterialstock.AreaName = area.AreaName; |
| | | |
| | | wmsmaterialstock.MaterialModel = material.MaterialModel; |
| | | wmsmaterialstock.MaterialBatch = input.MaterialBatch; |
| | |
| | | |
| | | |
| | | container.ContainerStatus = Domain.Shared.Enums.ContainerStatusEnum.KUWEI; |
| | | place.PlaceStatus = Domain.Shared.Enums.PlaceStatusEnum.CUNHUO; |
| | | place.Islock = input.IsLock; |
| | | |
| | | await _wmscontainerRepository.UpdateAsync(container); |
| | | await _wmsplaceRepository.UpdateAsync(place); |
| | | |
| | | //if (input.Sort.HasValue && wmsmaterialstock.Sort != maxSort) |
| | | //{ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using AutoMapper; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsContainerPlace; |
| | | using CMS.Plugin.HIAWms.Domain.WmsContainerPlace; |
| | | using Volo.Abp.ObjectExtending; |
| | | |
| | | namespace CMS.Plugin.HIAWms.Application.MapperProfiles; |
| | | |
| | | /// <summary> |
| | | /// åºä½å®¹å¨å
³ç³»AutoMapperé
ç½® |
| | | /// </summary> |
| | | /// <seealso cref="AutoMapper.Profile" /> |
| | | public class WmsContainerPlaceAutoMapperProfile : Profile |
| | | { |
| | | /// <summary> |
| | | /// Initializes a new instance of the <see cref="WmsContainerPlaceAutoMapperProfile"/> class. |
| | | /// </summary> |
| | | public WmsContainerPlaceAutoMapperProfile() |
| | | { |
| | | /* You can configure your AutoMapper mapping configuration here. |
| | | * Alternatively, you can split your mapping configurations |
| | | * into multiple profile classes for a better organization. */ |
| | | CreateMap<WmsContainerPlace, WmsContainerPlaceDto>(MemberList.None).MapExtraProperties(MappingPropertyDefinitionChecks.None); |
| | | CreateMap<WmsContainerPlaceCreateDto, WmsContainerPlace>(MemberList.None).MapExtraProperties(MappingPropertyDefinitionChecks.None); |
| | | CreateMap<GetWmsContainerPlaceInput, WmsContainerPlace>(MemberList.None).MapExtraProperties(MappingPropertyDefinitionChecks.None); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using CmsQueryExtensions.Extension; |
| | | using System.Linq.Expressions; |
| | | using Volo.Abp.Domain.Repositories; |
| | | |
| | | namespace CMS.Plugin.HIAWms.Domain.WmsContainerPlace; |
| | | |
| | | /// <summary> |
| | | /// åºä½å®¹å¨å
³ç³»ä»å¨ |
| | | /// </summary> |
| | | public interface IWmsContainerPlaceRepository : IBasicRepository<WmsContainerPlace, Guid> |
| | | { |
| | | /// <summary> |
| | | /// æç
§åç§°æ¥æ¾åºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="name"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | Task<WmsContainerPlace> FindByNameAsync(string name, CancellationToken cancellationToken = default); |
| | | |
| | | /// <summary> |
| | | /// éªè¯åç§°æ¯å¦åå¨åºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="name"></param> |
| | | /// <param name="id"></param> |
| | | /// <returns></returns> |
| | | Task<bool> NameExistAsync(string name, Guid? id = null); |
| | | |
| | | /// <summary> |
| | | /// è·åæå¤§æåºåºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | Task<int> GetMaxSortAsync(); |
| | | |
| | | /// <summary> |
| | | /// è·åå页å表åºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="whereConditions"></param> |
| | | /// <param name="sorting"></param> |
| | | /// <param name="maxResultCount"></param> |
| | | /// <param name="skipCount"></param> |
| | | /// <param name="includeDetails"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | Task<List<WmsContainerPlace>> GetListAsync(FunReturnResultModel<Expression<Func<WmsContainerPlace, bool>>> whereConditions, string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, bool includeDetails = false, CancellationToken cancellationToken = default); |
| | | |
| | | /// <summary> |
| | | /// è·åæ»æ°åºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="whereConditions"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | Task<long> GetCountAsync(FunReturnResultModel<Expression<Func<WmsContainerPlace, bool>>> whereConditions, CancellationToken cancellationToken = default); |
| | | } |
ÎļþÃû´Ó HIAWms/server/src/CMS.Plugin.HIAWms.Domain/WmsContainerPlaces/WmsContainerPlace.cs ÐÞ¸Ä |
| | |
| | | using System.Threading.Tasks; |
| | | using Volo.Abp.Domain.Entities.Auditing; |
| | | |
| | | namespace CMS.Plugin.HIAWms.Domain.WmsContainerPlaces |
| | | namespace CMS.Plugin.HIAWms.Domain.WmsContainerPlace |
| | | { |
| | | /// <summary> |
| | | /// åºä½å®¹å¨å
³ç³» |
| | |
| | | Task<WmsMaterial> FindByNameAsync(string name, CancellationToken cancellationToken = default); |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®åå·ä¼ ç©æ |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | Task<WmsMaterial> FindByModelAsync(string model, CancellationToken cancellationToken = default); |
| | | |
| | | /// <summary> |
| | | /// Names the exist asynchronous. |
| | | /// </summary> |
| | | /// <param name="name">The name.</param> |
| | |
| | | /// <param name="cancellationToken">The cancellation token.</param> |
| | | /// <returns></returns> |
| | | Task<long> GetCountAsync(WmsMaterial material, string filter = null, Specification<WmsMaterial> specification = null, CancellationToken cancellationToken = default); |
| | | |
| | | /// <summary> |
| | | /// è·åç©æå表 |
| | | /// </summary> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | Task<List<WmsMaterial>> GetListForSelectAsync(CancellationToken cancellationToken = default); |
| | | } |
| | |
| | | /// <summary> |
| | | /// ç©æç¼ç ï¼å¯ä¸æ è¯ï¼ |
| | | /// </summary> |
| | | public string MaterialCode { get; set; } |
| | | public string MaterialNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æåç§° |
| | |
| | | /// </summary> |
| | | public class WmsMaterialSpecification : Volo.Abp.Specifications.Specification<WmsMaterial> |
| | | { |
| | | private readonly string _materialCode; |
| | | private readonly string _MaterialNo; |
| | | |
| | | /// <summary> |
| | | /// Initializes a new instance of the <see cref="WmsMaterialSpecification"/> class. |
| | |
| | | /// <summary> |
| | | /// Initializes a new instance of the <see cref="WmsMaterialSpecification"/> class. |
| | | /// </summary> |
| | | /// <param name="materialCode">The name.</param> |
| | | public WmsMaterialSpecification(string materialCode = null) |
| | | /// <param name="MaterialNo">The name.</param> |
| | | public WmsMaterialSpecification(string MaterialNo = null) |
| | | { |
| | | _materialCode = materialCode; |
| | | _MaterialNo = MaterialNo; |
| | | } |
| | | |
| | | /// <inheritdoc /> |
| | |
| | | { |
| | | Expression<Func<WmsMaterial, bool>> expression = c => 1 == 1; |
| | | |
| | | if (_materialCode != null) |
| | | if (_MaterialNo != null) |
| | | { |
| | | expression = expression.And(c => c.MaterialCode == _materialCode); |
| | | expression = expression.And(c => c.MaterialNo == _MaterialNo); |
| | | } |
| | | |
| | | return expression; |
| | |
| | | using CMS.Plugin.HIAWms.Domain.Shared.Enums; |
| | | using CMS.Plugin.HIAWms.Domain.WmsAreas; |
| | | using Volo.Abp.Domain.Repositories; |
| | | using Volo.Abp.Specifications; |
| | |
| | | /// <param name="cancellationToken">The cancellation token.</param> |
| | | /// <returns></returns> |
| | | Task<long> GetCountAsync(WmsPlace? place, string filter = null, Specification<WmsPlace> specification = null, CancellationToken cancellationToken = default); |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®ç±»åè·ååºä½å表 |
| | | /// </summary> |
| | | /// <param name="placeType"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | Task<List<WmsPlace>> GetPlaceListForSelectAsync(PlaceTypeEnum placeType, CancellationToken cancellationToken = default); |
| | | } |
| | |
| | | using CMS.Plugin.HIAWms.Domain; |
| | | using CMS.Plugin.HIAWms.Domain.WmsContainerPlaces; |
| | | using CMS.Plugin.HIAWms.Domain.WmsContainers; |
| | | using Microsoft.EntityFrameworkCore; |
| | | using System; |
| | |
| | | using CMS.Plugin.MyExtension; |
| | | using Volo.Abp.EntityFrameworkCore.Modeling; |
| | | using CMS.Plugin.MyExtension.Domain; |
| | | using CMS.Plugin.HIAWms.Domain.WmsContainerPlace; |
| | | |
| | | namespace CMS.Plugin.HIAWms.EntityFrameworkCore.Extensions |
| | | { |
| | |
| | | b.HasKey(x => x.Id); |
| | | |
| | | // åæ®µé
ç½® |
| | | b.Property(x => x.MaterialCode) |
| | | b.Property(x => x.MaterialNo) |
| | | .HasMaxLength(64) |
| | | .IsRequired() |
| | | .HasComment("ç©æç¼ç ï¼å¯ä¸æ è¯ï¼"); |
| | |
| | | .HasComment("æ¯å¦ç¦ç¨"); |
| | | |
| | | // ç´¢å¼é
ç½® |
| | | b.HasIndex(x => x.MaterialCode).IsUnique(); // ç©æç¼ç å¯ä¸ç´¢å¼ |
| | | b.HasIndex(x => x.MaterialNo).IsUnique(); // ç©æç¼ç å¯ä¸ç´¢å¼ |
| | | b.HasIndex(x => x.MaterialName); // ç©æåç§°æ®éç´¢å¼ |
| | | b.HasIndex(x => x.PurchaseType); // éè´ç±»åç´¢å¼ï¼å¦éæ¥è¯¢è¿æ»¤ï¼ |
| | | b.HasIndex(x => x.MaterialType); // ç©æç±»åç´¢å¼ï¼å¦éæ¥è¯¢è¿æ»¤ï¼ |
| | |
| | | using CMS.Plugin.HIAWms.Domain; |
| | | using CMS.Plugin.HIAWms.Domain.WmsContainerPlaces; |
| | | using CMS.Plugin.HIAWms.Domain.WmsContainerPlace; |
| | | using CMS.Plugin.HIAWms.Domain.WmsMaterialContainer; |
| | | using Microsoft.EntityFrameworkCore; |
| | | using System; |
| | |
| | | using CMS.Plugin.HIAWms.Domain; |
| | | using CMS.Plugin.HIAWms.Domain.WmsContainerPlaces; |
| | | using CMS.Plugin.HIAWms.Domain.WmsContainerPlace; |
| | | using CMS.Plugin.HIAWms.Domain.WmsTask; |
| | | using Microsoft.EntityFrameworkCore; |
| | | using System; |
| | |
| | | public async Task<List<WmsArea>> GetListForSelectAsync(CancellationToken cancellationToken = default) |
| | | { |
| | | return await (await GetDbSetAsync()) |
| | | .Where(x => !x.IsDeleted) |
| | | .ToListAsync(GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using CMS.Plugin.HIAWms.Domain.WmsContainerPlace; |
| | | using CMS.Plugin.HIAWms.EntityFrameworkCore.Extensions; |
| | | using CmsQueryExtensions.Extension; |
| | | using Microsoft.EntityFrameworkCore; |
| | | using System.Linq.Dynamic.Core; |
| | | using System.Linq.Expressions; |
| | | using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
| | | using Volo.Abp.EntityFrameworkCore; |
| | | |
| | | |
| | | namespace CMS.Plugin.HIAWms.EntityFrameworkCore.Repositories; |
| | | |
| | | /// <summary> |
| | | /// åºä½å®¹å¨å
³ç³»ä»å¨å®ç° |
| | | /// </summary> |
| | | public class EfCoreWmsContainerPlaceRepository : EfCoreRepository<ICMSPluginDbContext, WmsContainerPlace, Guid>, IWmsContainerPlaceRepository |
| | | { |
| | | /// <summary> |
| | | /// Initializes a new instance of the <see cref="EfCoreWmsContainerPlaceRepository"/> class. |
| | | /// </summary> |
| | | /// <param name="dbContextProvider">The database context provider.</param> |
| | | public EfCoreWmsContainerPlaceRepository(IDbContextProvider<ICMSPluginDbContext> dbContextProvider) |
| | | : base(dbContextProvider) |
| | | { |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æç
§åç§°æ¥æ¾åºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="name"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public virtual async Task<WmsContainerPlace> FindByNameAsync(string name, CancellationToken cancellationToken = default) |
| | | { |
| | | return await (await GetDbSetAsync()) |
| | | .IncludeDetails() |
| | | .Where(x => !x.IsDeleted) |
| | | .OrderByDescending(x=>x.CreationTime) |
| | | .FirstOrDefaultAsync(t => t.PlaceNo == name, GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éªè¯åç§°æ¯å¦åå¨åºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="name">æ ¡éªå¼</param> |
| | | /// <param name="id"></param> |
| | | /// <returns></returns> |
| | | public async Task<bool> NameExistAsync(string name, Guid? id = null) |
| | | { |
| | | return await (await GetDbSetAsync()).WhereIf(id.HasValue, p => p.Id != id).Where(x => !x.IsDeleted).AnyAsync(x => x.PlaceNo == name); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åæå¤§æåºåºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public async Task<int> GetMaxSortAsync() |
| | | { |
| | | var hasAny = await (await GetQueryableAsync()) |
| | | .Where(x => !x.IsDeleted).AnyAsync(); |
| | | if (!hasAny) |
| | | { |
| | | return 1; |
| | | } |
| | | |
| | | var sort = await (await GetQueryableAsync()) |
| | | .Where(x => !x.IsDeleted).MaxAsync(x => x.Sort); |
| | | return sort + 1; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åå页å表åºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="whereConditions"></param> |
| | | /// <param name="sorting"></param> |
| | | /// <param name="maxResultCount"></param> |
| | | /// <param name="skipCount"></param> |
| | | /// <param name="includeDetails"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public async Task<List<WmsContainerPlace>> GetListAsync(FunReturnResultModel<Expression<Func<WmsContainerPlace, bool>>> whereConditions, string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, bool includeDetails = false, CancellationToken cancellationToken = default) |
| | | { |
| | | return await (await GetDbSetAsync()) |
| | | .IncludeDetails(includeDetails) |
| | | .WhereIf(whereConditions != null, whereConditions.data) |
| | | .Where(x => !x.IsDeleted) |
| | | .OrderByDescending(x=>x.CreationTime) |
| | | .PageBy(skipCount, maxResultCount) |
| | | .ToListAsync(GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åæ»æ°åºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="whereConditions"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public async Task<long> GetCountAsync(FunReturnResultModel<Expression<Func<WmsContainerPlace, bool>>> whereConditions, CancellationToken cancellationToken = default) |
| | | { |
| | | return await (await GetQueryableAsync()) |
| | | .WhereIf(whereConditions != null, whereConditions.data) |
| | | .Where(x => !x.IsDeleted) |
| | | .CountAsync(cancellationToken: GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | | |
| | | /// <inheritdoc /> |
| | | public override async Task<IQueryable<WmsContainerPlace>> WithDetailsAsync() |
| | | { |
| | | return (await GetQueryableAsync()) |
| | | .Where(x => !x.IsDeleted).IncludeDetails(); |
| | | } |
| | | } |
| | |
| | | using System.Linq; |
| | | using System.Linq.Dynamic.Core; |
| | | using System.Linq.Expressions; |
| | | using CMS.Plugin.HIAWms.Domain.WmsAreas; |
| | | using CMS.Plugin.HIAWms.Domain.WmsMaterials; |
| | | using CMS.Plugin.HIAWms.EntityFrameworkCore.Extensions; |
| | | using Microsoft.EntityFrameworkCore; |
| | |
| | | .IncludeDetails() |
| | | .Where(x => !x.IsDeleted) |
| | | .OrderBy(t => t.Sort) |
| | | .FirstOrDefaultAsync(t => t.MaterialCode == name, GetCancellationToken(cancellationToken)); |
| | | .FirstOrDefaultAsync(t => t.MaterialNo == name, GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¥æ¾åå· |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public virtual async Task<WmsMaterial> FindByModelAsync(string model, CancellationToken cancellationToken = default) |
| | | { |
| | | return await (await GetDbSetAsync()) |
| | | .IncludeDetails() |
| | | .Where(x => !x.IsDeleted) |
| | | .OrderBy(t => t.Sort) |
| | | .FirstOrDefaultAsync(t => t.MaterialModel == model, GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | | /// <inheritdoc /> |
| | | public async Task<bool> NameExistAsync(string materialCode, Guid? id = null) |
| | | public async Task<bool> NameExistAsync(string MaterialNo, Guid? id = null) |
| | | { |
| | | return await (await GetDbSetAsync()).WhereIf(id.HasValue, p => p.Id != id).Where(x => !x.IsDeleted).AnyAsync(x => x.MaterialCode == materialCode); |
| | | return await (await GetDbSetAsync()).WhereIf(id.HasValue, p => p.Id != id).Where(x => !x.IsDeleted).AnyAsync(x => x.MaterialNo == MaterialNo); |
| | | } |
| | | |
| | | /// <inheritdoc /> |
| | |
| | | return await (await GetDbSetAsync()) |
| | | .IncludeDetails(includeDetails) |
| | | .Where(specification.ToExpression()) |
| | | .WhereIf(!filter.IsNullOrWhiteSpace(), u => u.MaterialCode.Contains(filter)) |
| | | .WhereIf(!filter.IsNullOrWhiteSpace(), u => u.MaterialNo.Contains(filter)) |
| | | .WhereIf(!string.IsNullOrEmpty(material.MaterialName), u => u.MaterialName.Contains(material.MaterialName)) |
| | | .WhereIf(!string.IsNullOrEmpty(material.MaterialCode), u => u.MaterialName.Contains(material.MaterialCode)) |
| | | .WhereIf(!string.IsNullOrEmpty(material.MaterialNo), u => u.MaterialName.Contains(material.MaterialNo)) |
| | | .WhereIf(material.MaterialType > 0, u => u.MaterialType == material.MaterialType) |
| | | .WhereIf(material.PurchaseType > 0, u => u.PurchaseType == material.PurchaseType) |
| | | .Where(x => !x.IsDeleted) |
| | |
| | | { |
| | | return await (await GetDbSetAsync()) |
| | | .WhereIf(!string.IsNullOrEmpty(material.MaterialName), u => u.MaterialName.Contains(material.MaterialName)) |
| | | .WhereIf(!string.IsNullOrEmpty(material.MaterialCode), u => u.MaterialName.Contains(material.MaterialCode)) |
| | | .WhereIf(!string.IsNullOrEmpty(material.MaterialNo), u => u.MaterialName.Contains(material.MaterialNo)) |
| | | .WhereIf(material.MaterialType > 0, u => u.MaterialType == material.MaterialType) |
| | | .WhereIf(material.PurchaseType > 0, u => u.PurchaseType == material.PurchaseType) |
| | | .Where(x => !x.IsDeleted) |
| | |
| | | return await (await GetQueryableAsync()) |
| | | .Where(specification.ToExpression()) |
| | | .WhereIf(!string.IsNullOrEmpty(material.MaterialName), u => u.MaterialName.Contains(material.MaterialName)) |
| | | .WhereIf(!string.IsNullOrEmpty(material.MaterialCode), u => u.MaterialName.Contains(material.MaterialCode)) |
| | | .WhereIf(!string.IsNullOrEmpty(material.MaterialNo), u => u.MaterialName.Contains(material.MaterialNo)) |
| | | .WhereIf(material.MaterialType > 0, u => u.MaterialType == material.MaterialType) |
| | | .WhereIf(material.PurchaseType > 0, u => u.PurchaseType == material.PurchaseType) |
| | | .Where(x => !x.IsDeleted) |
| | | .WhereIf(!filter.IsNullOrWhiteSpace(), u => u.MaterialCode.Contains(filter)) |
| | | .WhereIf(!filter.IsNullOrWhiteSpace(), u => u.MaterialNo.Contains(filter)) |
| | | .CountAsync(cancellationToken: GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | |
| | | return (await GetQueryableAsync()) |
| | | .Where(x => !x.IsDeleted).IncludeDetails(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åç©æè¡¨ |
| | | /// </summary> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public async Task<List<WmsMaterial>> GetListForSelectAsync(CancellationToken cancellationToken = default) |
| | | { |
| | | return await (await GetDbSetAsync()) |
| | | .Where(x => !x.IsDeleted) |
| | | .ToListAsync(GetCancellationToken(cancellationToken)); |
| | | } |
| | | } |
| | |
| | | using System.Linq.Dynamic.Core; |
| | | using CMS.Plugin.HIAWms.Domain.Shared.Enums; |
| | | using CMS.Plugin.HIAWms.Domain.WmsAreas; |
| | | using CMS.Plugin.HIAWms.Domain.WmsPlaces; |
| | | using CMS.Plugin.HIAWms.EntityFrameworkCore.Extensions; |
| | |
| | | /// <returns></returns> |
| | | public async Task<List<WmsPlace>> GetAisleListForSelectAsync(CancellationToken cancellationToken = default) |
| | | { |
| | | return await (await GetDbSetAsync()) |
| | | return await (await GetDbSetAsync()).Where(x => !x.IsDeleted) |
| | | .ToListAsync(GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | |
| | | return (await GetQueryableAsync()) |
| | | .Where(x => !x.IsDeleted).IncludeDetails(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·ååºåºå表 |
| | | /// </summary> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public async Task<List<WmsPlace>> GetPlaceListForSelectAsync(PlaceTypeEnum placeType,CancellationToken cancellationToken = default) |
| | | { |
| | | return await (await GetDbSetAsync()) |
| | | .Where(x => !x.IsDeleted) |
| | | .Where(x=>x.StorageTypeNo == placeType) |
| | | .ToListAsync(GetCancellationToken(cancellationToken)); |
| | | } |
| | | } |
| | |
| | | public async Task<List<WmsStore>> GetListForSelectAsync( CancellationToken cancellationToken = default) |
| | | { |
| | | return await (await GetDbSetAsync()) |
| | | .Where(x=>!x.IsDeleted) |
| | | .ToListAsync(GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | |
| | | .HasColumnType("decimal(18,2)") |
| | | .HasComment("é¿åº¦ï¼åä½ï¼mï¼"); |
| | | |
| | | b.Property<string>("MaterialCode") |
| | | b.Property<string>("MaterialNo") |
| | | .IsRequired() |
| | | .HasMaxLength(64) |
| | | .HasColumnType("varchar(64)") |
| | |
| | | |
| | | b.HasKey("Id"); |
| | | |
| | | b.HasIndex("MaterialCode") |
| | | b.HasIndex("MaterialNo") |
| | | .IsUnique(); |
| | | |
| | | b.HasIndex("MaterialName"); |
| | |
| | | columns: table => new |
| | | { |
| | | Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
| | | MaterialCode = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "ç©æç¼ç ï¼å¯ä¸æ è¯ï¼") |
| | | MaterialNo = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "ç©æç¼ç ï¼å¯ä¸æ è¯ï¼") |
| | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | | MaterialName = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false, comment: "ç©æåç§°") |
| | | .Annotation("MySql:CharSet", "utf8mb4"), |
| | |
| | | column: "ContainerType"); |
| | | |
| | | migrationBuilder.CreateIndex( |
| | | name: "IX_scms_wmsmaterials_MaterialCode", |
| | | name: "IX_scms_wmsmaterials_MaterialNo", |
| | | table: "scms_wmsmaterials", |
| | | column: "MaterialCode", |
| | | column: "MaterialNo", |
| | | unique: true); |
| | | |
| | | migrationBuilder.CreateIndex( |
| | |
| | | .HasColumnType("decimal(18,2)") |
| | | .HasComment("é¿åº¦ï¼åä½ï¼mï¼"); |
| | | |
| | | b.Property<string>("MaterialCode") |
| | | b.Property<string>("MaterialNo") |
| | | .IsRequired() |
| | | .HasMaxLength(64) |
| | | .HasColumnType("varchar(64)") |
| | |
| | | |
| | | b.HasKey("Id"); |
| | | |
| | | b.HasIndex("MaterialCode") |
| | | b.HasIndex("MaterialNo") |
| | | .IsUnique(); |
| | | |
| | | b.HasIndex("MaterialName"); |
| | |
| | | .HasColumnType("decimal(18,2)") |
| | | .HasComment("é¿åº¦ï¼åä½ï¼mï¼"); |
| | | |
| | | b.Property<string>("MaterialCode") |
| | | b.Property<string>("MaterialNo") |
| | | .IsRequired() |
| | | .HasMaxLength(64) |
| | | .HasColumnType("varchar(64)") |
| | |
| | | |
| | | b.HasKey("Id"); |
| | | |
| | | b.HasIndex("MaterialCode") |
| | | b.HasIndex("MaterialNo") |
| | | .IsUnique(); |
| | | |
| | | b.HasIndex("MaterialName"); |
| | |
| | | .HasColumnType("decimal(18,2)") |
| | | .HasComment("é¿åº¦ï¼åä½ï¼mï¼"); |
| | | |
| | | b.Property<string>("MaterialCode") |
| | | b.Property<string>("MaterialNo") |
| | | .IsRequired() |
| | | .HasMaxLength(64) |
| | | .HasColumnType("varchar(64)") |
| | |
| | | |
| | | b.HasKey("Id"); |
| | | |
| | | b.HasIndex("MaterialCode") |
| | | b.HasIndex("MaterialNo") |
| | | .IsUnique(); |
| | | |
| | | b.HasIndex("MaterialName"); |
| | |
| | | .HasColumnType("decimal(18,2)") |
| | | .HasComment("é¿åº¦ï¼åä½ï¼mï¼"); |
| | | |
| | | b.Property<string>("MaterialCode") |
| | | b.Property<string>("MaterialNo") |
| | | .IsRequired() |
| | | .HasMaxLength(64) |
| | | .HasColumnType("varchar(64)") |
| | |
| | | |
| | | b.HasKey("Id"); |
| | | |
| | | b.HasIndex("MaterialCode") |
| | | b.HasIndex("MaterialNo") |
| | | .IsUnique(); |
| | | |
| | | b.HasIndex("MaterialName"); |
| | |
| | | .HasColumnType("decimal(18,2)") |
| | | .HasComment("é¿åº¦ï¼åä½ï¼mï¼"); |
| | | |
| | | b.Property<string>("MaterialCode") |
| | | b.Property<string>("MaterialNo") |
| | | .IsRequired() |
| | | .HasMaxLength(64) |
| | | .HasColumnType("varchar(64)") |
| | |
| | | |
| | | b.HasKey("Id"); |
| | | |
| | | b.HasIndex("MaterialCode") |
| | | b.HasIndex("MaterialNo") |
| | | .IsUnique(); |
| | | |
| | | b.HasIndex("MaterialName"); |
| | |
| | | .HasColumnType("decimal(18,2)") |
| | | .HasComment("é¿åº¦ï¼åä½ï¼mï¼"); |
| | | |
| | | b.Property<string>("MaterialCode") |
| | | b.Property<string>("MaterialNo") |
| | | .IsRequired() |
| | | .HasMaxLength(64) |
| | | .HasColumnType("varchar(64)") |
| | |
| | | |
| | | b.HasKey("Id"); |
| | | |
| | | b.HasIndex("MaterialCode") |
| | | b.HasIndex("MaterialNo") |
| | | .IsUnique(); |
| | | |
| | | b.HasIndex("MaterialName"); |
| | |
| | | .HasColumnType("decimal(18,2)") |
| | | .HasComment("é¿åº¦ï¼åä½ï¼mï¼"); |
| | | |
| | | b.Property<string>("MaterialCode") |
| | | b.Property<string>("MaterialNo") |
| | | .IsRequired() |
| | | .HasMaxLength(64) |
| | | .HasColumnType("varchar(64)") |
| | |
| | | |
| | | b.HasKey("Id"); |
| | | |
| | | b.HasIndex("MaterialCode") |
| | | b.HasIndex("MaterialNo") |
| | | .IsUnique(); |
| | | |
| | | b.HasIndex("MaterialName"); |
| | |
| | | .HasColumnType("decimal(18,2)") |
| | | .HasComment("é¿åº¦ï¼åä½ï¼mï¼"); |
| | | |
| | | b.Property<string>("MaterialCode") |
| | | b.Property<string>("MaterialNo") |
| | | .IsRequired() |
| | | .HasMaxLength(64) |
| | | .HasColumnType("varchar(64)") |
| | |
| | | |
| | | b.HasKey("Id"); |
| | | |
| | | b.HasIndex("MaterialCode") |
| | | b.HasIndex("MaterialNo") |
| | | .IsUnique(); |
| | | |
| | | b.HasIndex("MaterialName"); |
| | |
| | | .HasColumnType("decimal(18,2)") |
| | | .HasComment("é¿åº¦ï¼åä½ï¼mï¼"); |
| | | |
| | | b.Property<string>("MaterialCode") |
| | | b.Property<string>("MaterialNo") |
| | | .IsRequired() |
| | | .HasMaxLength(64) |
| | | .HasColumnType("varchar(64)") |
| | |
| | | |
| | | b.HasKey("Id"); |
| | | |
| | | b.HasIndex("MaterialCode") |
| | | b.HasIndex("MaterialNo") |
| | | .IsUnique(); |
| | | |
| | | b.HasIndex("MaterialName"); |
| | |
| | | .HasColumnType("decimal(18,2)") |
| | | .HasComment("é¿åº¦ï¼åä½ï¼mï¼"); |
| | | |
| | | b.Property<string>("MaterialCode") |
| | | b.Property<string>("MaterialNo") |
| | | .IsRequired() |
| | | .HasMaxLength(64) |
| | | .HasColumnType("varchar(64)") |
| | |
| | | |
| | | b.HasKey("Id"); |
| | | |
| | | b.HasIndex("MaterialCode") |
| | | b.HasIndex("MaterialNo") |
| | | .IsUnique(); |
| | | |
| | | b.HasIndex("MaterialName"); |
| | |
| | | .HasColumnType("decimal(18,2)") |
| | | .HasComment("é¿åº¦ï¼åä½ï¼mï¼"); |
| | | |
| | | b.Property<string>("MaterialCode") |
| | | b.Property<string>("MaterialNo") |
| | | .IsRequired() |
| | | .HasMaxLength(64) |
| | | .HasColumnType("varchar(64)") |
| | |
| | | |
| | | b.HasKey("Id"); |
| | | |
| | | b.HasIndex("MaterialCode") |
| | | b.HasIndex("MaterialNo") |
| | | .IsUnique(); |
| | | |
| | | b.HasIndex("MaterialName"); |
| | |
| | | .HasColumnType("decimal(18,2)") |
| | | .HasComment("é¿åº¦ï¼åä½ï¼mï¼"); |
| | | |
| | | b.Property<string>("MaterialCode") |
| | | b.Property<string>("MaterialNo") |
| | | .IsRequired() |
| | | .HasMaxLength(64) |
| | | .HasColumnType("varchar(64)") |
| | |
| | | |
| | | b.HasKey("Id"); |
| | | |
| | | b.HasIndex("MaterialCode") |
| | | b.HasIndex("MaterialNo") |
| | | .IsUnique(); |
| | | |
| | | b.HasIndex("MaterialName"); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Ao.Lang; |
| | | using CMS.Extensions.Abp.AspNetCore.Mvc.Filters; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsContainerPlace; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Services; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using MiniExcelLibs; |
| | | using System.Reflection; |
| | | using Volo.Abp; |
| | | using Volo.Abp.Application.Dtos; |
| | | |
| | | namespace CMS.Plugin.HIAWms.Controller |
| | | { |
| | | /// <summary> |
| | | /// åºä½å®¹å¨å
³ç³»æå¡ |
| | | /// </summary> |
| | | [ApiController] |
| | | [TypeFilter(typeof(CMSLanguageFilter))] |
| | | [TypeFilter(typeof(CMSUowActionFilter))] |
| | | [TypeFilter(typeof(CMSAuditActionFilter))] |
| | | [TypeFilter(typeof(CMSExceptionFilter))] |
| | | [Route("api/v{version:apiVersion}/HIAWms/[controller]")] |
| | | public class WmsContainerPlaceController : ControllerBase |
| | | { |
| | | private readonly IWmsContainerPlaceAppService _wmsContainerPlaceAppService; |
| | | |
| | | /// <summary> |
| | | /// Initializes a new instance of the <see cref="WmsContainerPlaceController"/> class. |
| | | /// </summary> |
| | | /// <param name="wmsContainerPlaceAppService">The wmsContainerPlace application service.</param> |
| | | public WmsContainerPlaceController(IWmsContainerPlaceAppService wmsContainerPlaceAppService) |
| | | { |
| | | _wmsContainerPlaceAppService = wmsContainerPlaceAppService; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·ååºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="id">æ è¯ç¬¦.</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [Route("{id}")] |
| | | public virtual Task<WmsContainerPlaceDto> GetAsync(Guid id) |
| | | { |
| | | return _wmsContainerPlaceAppService.GetAsync(id); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å页è·ååºä½å®¹å¨å
³ç³»çå表. |
| | | /// </summary> |
| | | /// <param name="input">è¾å
¥.</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [Route("Page")] |
| | | public virtual Task<PagedResultDto<WmsContainerPlaceDto>> GetListAsync([FromQuery] GetWmsContainerPlaceInput input) |
| | | { |
| | | return _wmsContainerPlaceAppService.GetListAsync(input); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å建åºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="input">è¾å
¥.</param> |
| | | /// <returns></returns> |
| | | //[Authorize] |
| | | [HttpPost] |
| | | public virtual Task<WmsContainerPlaceDto> CreateAsync(WmsContainerPlaceCreateDto input) |
| | | { |
| | | return _wmsContainerPlaceAppService.CreateAsync(input); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°åºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="id">æ è¯ç¬¦.</param> |
| | | /// <param name="input">è¾å
¥.</param> |
| | | /// <returns></returns> |
| | | //[Authorize] |
| | | [HttpPut] |
| | | [Route("{id}")] |
| | | public virtual Task<WmsContainerPlaceDto> UpdateAsync(Guid id, WmsContainerPlaceUpdateDto input) |
| | | { |
| | | return _wmsContainerPlaceAppService.UpdateAsync(id, input); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å
éåºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="ids">Idéå.</param> |
| | | /// <returns></returns> |
| | | //[Authorize] |
| | | [HttpPost] |
| | | [Route("Clone")] |
| | | public virtual Task<List<WmsContainerPlaceDto>> CloneAsync([FromBody] IEnumerable<Guid> ids) |
| | | { |
| | | return _wmsContainerPlaceAppService.CloneAsync(ids); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å é¤åºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="id">æ è¯ç¬¦.</param> |
| | | /// <returns></returns> |
| | | //[Authorize] |
| | | [HttpDelete] |
| | | [Route("{id}")] |
| | | public virtual Task DeleteAsync(Guid id) |
| | | { |
| | | return _wmsContainerPlaceAppService.DeleteAsync(id); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¹éå é¤åºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="ids">The ids.</param> |
| | | /// <returns></returns> |
| | | //[Authorize] |
| | | [HttpDelete] |
| | | public virtual Task DeleteAsync([FromBody] IEnumerable<Guid> ids) |
| | | { |
| | | return _wmsContainerPlaceAppService.DeleteManyAsync(ids); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è°æ´æåºåºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <param name="id">æ è¯ç¬¦.</param> |
| | | /// <returns></returns> |
| | | [HttpPut] |
| | | [Route("{id}/AdjustSort/{sort}")] |
| | | public virtual Task AdjustSortAsync(Guid id, int sort) |
| | | { |
| | | return _wmsContainerPlaceAppService.AdjustSortAsync(id, sort); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 导å
¥åºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Authorize] |
| | | [HttpPost] |
| | | [Route("Import")] |
| | | public virtual async Task<IActionResult> ImportAsync(IFormFile file) |
| | | { |
| | | using var stream = new MemoryStream(); |
| | | await file.CopyToAsync(stream); |
| | | stream.Seek(0L, SeekOrigin.Begin); |
| | | |
| | | var sheetNames = stream.GetSheetNames(); |
| | | var wmsContainerPlaceRows = sheetNames.Contains("é
ç½®") ? MiniExcel.Query<WmsContainerPlacesImportModel.WmsContainerPlaceImportModel>(stream, sheetName: "é
ç½®").ToList() : new(); |
| | | |
| | | if (!wmsContainerPlaceRows.Any()) |
| | | { |
| | | throw new UserFriendlyException("è¯·æ£æ¥å¯¼å
¥çè¡¨æ ¼"); |
| | | } |
| | | |
| | | await _wmsContainerPlaceAppService.ImportAsync(new WmsContainerPlacesImportModel |
| | | { |
| | | WmsContainerPlaces = wmsContainerPlaceRows, |
| | | }); |
| | | |
| | | return Ok(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 导åºåºä½å®¹å¨å
³ç³» |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [Route("Export")] |
| | | public virtual async Task<IActionResult> ExportAsync([FromQuery] GetWmsContainerPlaceInput input) |
| | | { |
| | | input.MaxResultCount = int.MaxValue; |
| | | var exportData = await _wmsContainerPlaceAppService.ExportAsync(input); |
| | | var templatePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"Resources/Templates/WmsContainerPlaceå¯¼åºæ¨¡æ¿.xlsx"); |
| | | if (!System.IO.File.Exists(templatePath)) |
| | | { |
| | | templatePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty, $"Resources/Templates/WmsContainerPlaceå¯¼åºæ¨¡æ¿.xlsx"); |
| | | } |
| | | |
| | | var memoryStream = new MemoryStream(); |
| | | await memoryStream.SaveAsByTemplateAsync(templatePath, exportData.Sheets); |
| | | memoryStream.Seek(0L, SeekOrigin.Begin); |
| | | return new FileStreamResult(memoryStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") { FileDownloadName = $"{exportData.FileName}_{DateTime.Now:yyyyMMddhhmmss}.xlsx" }; |
| | | } |
| | | } |
| | | } |
| | |
| | | using CMS.Extensions.Abp.AspNetCore.Mvc.Filters; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.CommonDto; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsEnumDto; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsStores; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Services; |
| | | using CMS.Plugin.HIAWms.Domain.Shared.Enums; |
| | | using CMS.Plugin.HIAWms.Domain.WmsMaterials; |
| | | using CmsQueryExtensions; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using System; |
| | |
| | | { |
| | | return await _wmsEnumAppService.GetAisleListAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åæºå |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [Route("ModelList")] |
| | | public async Task<List<MaterialModelOutput>> GetMaterialModeListAsync() |
| | | { |
| | | return await _wmsEnumAppService.GetMaterialModeListAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·ååºä½å表 |
| | | /// </summary> |
| | | /// <param name="placeType"></param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [Route("PlaceList")] |
| | | public async Task<List<PlaceListOutput>> GetPlaceListForSelectAsync(PlaceTypeEnum placeType) |
| | | { |
| | | return await _wmsEnumAppService.GetPlaceListForSelectAsync(placeType); |
| | | } |
| | | } |
| | | } |