public void Delete(AscmDeliBatSumDetail ascmDeliBatSumDetail)
 {
     try
     {
         YnDaoHelper.GetInstance().nHibernateHelper.Delete<AscmDeliBatSumDetail>(ascmDeliBatSumDetail);
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("删除失败(Delete AscmDeliBatSumDetail)", ex);
         throw ex;
     }
 }
Beispiel #2
0
        public AscmDeliBatSumDetail(AscmDeliBatSumDetail ascmDeliBatSumDetail, string ascmStatus, string mtlDocNumber)
        {
            this.id                   = ascmDeliBatSumDetail.id;
            this.mainId               = ascmDeliBatSumDetail.mainId;
            this.batchId              = ascmDeliBatSumDetail.batchId;
            this.materialId           = ascmDeliBatSumDetail.materialId;
            this.totalNumber          = ascmDeliBatSumDetail.totalNumber;
            this.appointmentStartTime = ascmDeliBatSumDetail.appointmentStartTime;
            this.appointmentEndTime   = ascmDeliBatSumDetail.appointmentEndTime;
            this.barcode              = ascmDeliBatSumDetail.barcode;

            this.ascmStatus   = ascmStatus;
            this.mtlDocNumber = mtlDocNumber;
        }
Beispiel #3
0
        public AscmDeliBatSumDetail(AscmDeliBatSumDetail ascmDeliBatSumDetail, string ascmStatus, string mtlDocNumber)
        {
            this.id = ascmDeliBatSumDetail.id;
            this.mainId = ascmDeliBatSumDetail.mainId;
            this.batchId = ascmDeliBatSumDetail.batchId;
            this.materialId = ascmDeliBatSumDetail.materialId;
            this.totalNumber = ascmDeliBatSumDetail.totalNumber;
            this.appointmentStartTime = ascmDeliBatSumDetail.appointmentStartTime;
            this.appointmentEndTime = ascmDeliBatSumDetail.appointmentEndTime;
            this.barcode = ascmDeliBatSumDetail.barcode;

            this.ascmStatus = ascmStatus;
            this.mtlDocNumber = mtlDocNumber;
        }
Beispiel #4
0
        public AscmDeliBatSumDetail(AscmDeliBatSumDetail ascmDeliBatSumDetail, decimal containerBindNumber, decimal checkQuantity, decimal receivedQuantity, Int64 containerNumber)
        {
            this.id                   = ascmDeliBatSumDetail.id;
            this.mainId               = ascmDeliBatSumDetail.mainId;
            this.batchId              = ascmDeliBatSumDetail.batchId;
            this.materialId           = ascmDeliBatSumDetail.materialId;
            this.totalNumber          = ascmDeliBatSumDetail.totalNumber;
            this.appointmentStartTime = ascmDeliBatSumDetail.appointmentStartTime;
            this.appointmentEndTime   = ascmDeliBatSumDetail.appointmentEndTime;
            this.barcode              = ascmDeliBatSumDetail.barcode;

            this.containerBindNumber = containerBindNumber;
            this.checkQuantity       = checkQuantity;
            this.receivedQuantity    = receivedQuantity;
            this.containerNumber     = containerNumber;
        }
Beispiel #5
0
        public AscmDeliBatSumDetail(AscmDeliBatSumDetail ascmDeliBatSumDetail, decimal containerBindNumber, decimal checkQuantity, decimal receivedQuantity, Int64 containerNumber)
        {
            this.id = ascmDeliBatSumDetail.id;
            this.mainId = ascmDeliBatSumDetail.mainId;
            this.batchId = ascmDeliBatSumDetail.batchId;
            this.materialId = ascmDeliBatSumDetail.materialId;
            this.totalNumber = ascmDeliBatSumDetail.totalNumber;
            this.appointmentStartTime = ascmDeliBatSumDetail.appointmentStartTime;
            this.appointmentEndTime = ascmDeliBatSumDetail.appointmentEndTime;
            this.barcode = ascmDeliBatSumDetail.barcode;

            this.containerBindNumber = containerBindNumber;
            this.checkQuantity = checkQuantity;
            this.receivedQuantity = receivedQuantity;
            this.containerNumber = containerNumber;
        }
 public void Update(AscmDeliBatSumDetail ascmDeliBatSumDetail)
 {
     try
     {
         using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
         {
             try
             {
                 YnDaoHelper.GetInstance().nHibernateHelper.Update<AscmDeliBatSumDetail>(ascmDeliBatSumDetail);
                 tx.Commit();//正确执行提交
             }
             catch (Exception ex)
             {
                 tx.Rollback();//回滚
                 YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Update AscmDeliBatSumDetail)", ex);
                 throw ex;
             }
         }
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Save AscmDeliBatSumDetail)", ex);
         throw ex;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                YnFrame.Dal.Entities.YnUser ynUser = YnFrame.Web.FormsAuthenticationService.GetInstance().GetTicketUserData();
                if (ynUser == null)
                    throw new Exception("用户错误!");
                AscmUserInfo ascmUserInfo = AscmUserInfoService.GetInstance().Get(ynUser.userId);
                if (ascmUserInfo.extExpandType != "erp")
                    throw new Exception("供应商用户错误!");
                AscmUserInfoService.GetInstance().SetSupplier(ascmUserInfo);
                if (ascmUserInfo.ascmSupplier == null)
                    throw new Exception("供应商用户错误!");

                //打印的数据
                List<AscmDeliBatSumDetail> sumList = new List<AscmDeliBatSumDetail>();
                //最后一个装箱
                AscmDeliBatSumDetail lastDetail = new AscmDeliBatSumDetail();
                string ids = Request.QueryString["ids"];
                string unitIds = Request.QueryString["unitIds"];
                string[] listId = ids.Split(',');
                string[] listUnitId = unitIds.Split(',');
                if (!string.IsNullOrEmpty(ids))
                {
                    List<AscmDeliBatSumDetail> list = new List<AscmDeliBatSumDetail>();
                    for (int i = 0; i < listId.Count(); i++)
                    {
                        AscmDeliBatSumDetail ascmDeliBatSumDetail = AscmDeliBatSumDetailService.GetInstance().Get(Int32.Parse(listId[i]));
                        AscmContainerUnitQuantity ascmContainerUnitQuantity = AscmContainerUnitQuantityService.GetInstance().Get(Int32.Parse(listUnitId[i]));
                        ascmDeliBatSumDetail.container = ascmContainerUnitQuantity.container;
                        ascmDeliBatSumDetail.materialUnitQuantity = ascmContainerUnitQuantity.unitQuantity;
                        ascmDeliBatSumDetail.containerUnitQuantityId = ascmContainerUnitQuantity.id;
                        list.Add(ascmDeliBatSumDetail);
                    }

                    if (list != null)
                    {
                        AscmDeliBatSumDetailService.GetInstance().SetMaterial(list);
                        AscmDeliBatSumDetailService.GetInstance().SetDeliveryOrderBatch(list);
                        List<AscmDeliveryOrderBatch> listDeliveryOrderBatch = new List<AscmDeliveryOrderBatch>();
                        list.ForEach(P => listDeliveryOrderBatch.Add(
                            new AscmDeliveryOrderBatch
                            {
                                id = P.batchId
                            }));
                        //获取货位分配
                        AscmDeliveryOrderBatchService.GetInstance().SetAssignWarelocation(listDeliveryOrderBatch);
                        list.ForEach(P => P.assignWarelocation = listDeliveryOrderBatch.Find(T => T.id == P.batchId).assignWarelocation);
                        foreach(AscmDeliBatSumDetail ascmDeliBatSumDetail in list)
                        {
                            //条码
                            System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                            if (ascmDeliBatSumDetail.ascmMaterialItem.docNumber != null)
                            {
                                #region Code128
                                MideaAscm.Code.BarCode128 barCode128 = new Code.BarCode128();
                                barCode128.TitleFont = new System.Drawing.Font("宋体", 10);
                                barCode128.HeightImage = 50;
                                System.Drawing.Bitmap bitmap = barCode128.GetCodeImage(ascmDeliBatSumDetail.batchBarCode, ascmDeliBatSumDetail.batchBarCode, Code.BarCode128.Encode.Code128B);
                                bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif);
                                bitmap.Dispose();
                                #endregion

                                #region Code39
                                //YnBaseClass2.Helper.BarCode39 barCode39 = new YnBaseClass2.Helper.BarCode39();
                                //barCode39.WidthCU = 10;
                                //barCode39.WidthXI = 3;
                                //System.Drawing.Bitmap bitmap = barCode39.CreateBarCode(ascmDeliBatSumDetail.ascmMaterialItem.docNumber, ascmDeliBatSumDetail.ascmMaterialItem.docNumber, 0, 0);
                                ////生成图片
                                ////System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                                //bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif);
                                //bitmap.Dispose();
                                #endregion
                            }
                            ascmDeliBatSumDetail.materialBarcode = memoryStream.ToArray();

                            decimal totalNumber = ascmDeliBatSumDetail.totalNumber;//总数量
                            decimal unitQuantity = ascmDeliBatSumDetail.materialUnitQuantity;//单元数
                            //decimal unitQuantity = 10;
                            decimal count = decimal.Truncate(totalNumber / unitQuantity);//箱数量>=0
                            decimal rest = totalNumber % unitQuantity;//剩余数量>=0

                            //设置装箱数 2015.3.26

                            //总数 < 单元数 ,仅有一个箱子,总数 = 剩余数量
                            if (count == 0)
                            {
                                count = 1;
                            }
                            else
                            {
                                //有剩余数量,多出一箱
                                if (rest != 0) count = count + 1;
                            }
                            for (int i = 0; i < count; i++)
                            {
                                //最后一个为剩余数量
                                if (i == count - 1 && rest != 0)
                                {
                                    lastDetail.ascmDeliveryOrderBatch = ascmDeliBatSumDetail.ascmDeliveryOrderBatch;
                                    lastDetail.ascmMaterialItem = ascmDeliBatSumDetail.ascmMaterialItem;
                                    lastDetail.assignWarelocation = ascmDeliBatSumDetail.assignWarelocation;
                                    lastDetail.materialUnitQuantity = rest;
                                    sumList.Add(lastDetail);
                                }
                                else
                                {
                                    sumList.Add(ascmDeliBatSumDetail);
                                }
                            }
                        }
                    }

                }

                ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                ReportViewer1.LocalReport.ReportPath = Server.MapPath("SupplierDriverDeliveryDetialBarCodeReport.rdlc");
                ReportDataSource rds1 = new ReportDataSource();
                rds1.Name = "DataSet1";
                rds1.Value = sumList;
                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(rds1);

                string companpyTitle = "美的中央空调";
                string title = companpyTitle + "供应商送货批单条码";

                ReportParameter[] reportParameters = new ReportParameter[] {
                    new ReportParameter("ReportParameter_SupplierName",ascmUserInfo.ascmSupplier.name )
                };

                ReportViewer1.LocalReport.SetParameters(reportParameters);
                ReportViewer1.LocalReport.Refresh();
            }
        }
        public ActionResult SupplierDeliveryBatSumDetailAdd(int? id, string deliveryOrderBatchJson, bool appointmentTimeFilter)
        {
            JsonObjectResult jsonObjectResult = new JsonObjectResult();
            try
            {
                if (id.HasValue && !string.IsNullOrEmpty(deliveryOrderBatchJson))
                {
                    double _supplierPassDuration = 0;
                    AscmUserInfo ascmUserInfo = AscmUserInfoService.GetInstance().Get(User.Identity.Name);
                    AscmUserInfoService.GetInstance().SetSupplier(ascmUserInfo);
                    if (ascmUserInfo.ascmSupplier != null)
                        _supplierPassDuration = ascmUserInfo.ascmSupplier.passDuration;

                    AscmDeliBatSumMain ascmDeliBatSumMain = AscmDeliBatSumMainService.GetInstance().Get(id.Value);
                    if (ascmDeliBatSumMain == null)
                        throw new Exception("找不到供应商送货合单");
                    if (ascmDeliBatSumMain.status != AscmDeliBatSumMain.StatusDefine.unConfirm)
                        throw new Exception("供应商合单状态错误");
                    List<AscmDeliveryOrderBatch> listAscmDeliveryOrderBatch = JsonConvert.DeserializeObject<List<AscmDeliveryOrderBatch>>(deliveryOrderBatchJson);
                    if (listAscmDeliveryOrderBatch != null && listAscmDeliveryOrderBatch.Count > 0)
                    {
                        //List<AscmDeliBatSumDetail> listAscmDeliBatSumDetail = AscmDeliBatSumDetailService.GetInstance().GetListByMainId(id.Value);
                        List<AscmDeliBatSumDetail> listAscmDeliBatSumDetail = AscmDeliBatSumDetailService.GetInstance().GetList("from AscmDeliBatSumDetail where mainId=" + id);
                        List<AscmDeliBatSumDetail> listAscmDeliBatSumDetailAdd = new List<AscmDeliBatSumDetail>();
                        int maxId = AscmDeliBatSumDetailService.GetInstance().GetMaxId();
                        foreach (AscmDeliveryOrderBatch ascmDeliveryOrderBatch in listAscmDeliveryOrderBatch)
                        {
                            AscmDeliBatSumDetail ascmDeliBatSumDetail = null;
                            if (listAscmDeliBatSumDetail != null && listAscmDeliBatSumDetail.Count > 0)
                                ascmDeliBatSumDetail = listAscmDeliBatSumDetail.Find(P => P.batchId == ascmDeliveryOrderBatch.id);
                            if (ascmDeliBatSumDetail == null)
                            {
                                ascmDeliBatSumDetail = new AscmDeliBatSumDetail();
                                ascmDeliBatSumDetail.id = ++maxId;
                                ascmDeliBatSumDetail.mainId = id.Value;
                                ascmDeliBatSumDetail.batchId = ascmDeliveryOrderBatch.id;
                                ascmDeliBatSumDetail.materialId = ascmDeliveryOrderBatch.materialIdTmp;
                                ascmDeliBatSumDetail.totalNumber = (int)ascmDeliveryOrderBatch.totalNumber;
                                ascmDeliBatSumDetail.appointmentStartTime = ascmDeliveryOrderBatch.appointmentStartTime;
                                ascmDeliBatSumDetail.appointmentEndTime = ascmDeliveryOrderBatch.appointmentEndTime;
                                /* 2014.3.14 合单中加入批单不改预约时间,取通知时间
                                #region 取送货通知预约时间
                                // 取送货通知预约时间
                                List<AscmDeliveryNotifyMain> list_AscmDeliveryNotifyMain = GetDeliveryNotifyList(ascmDeliveryOrderBatch.id.ToString());
                                string appointment_StartTime = "", appointment_EndTime = "";
                                AscmDeliBatSumMainService.GetInstance().GetAppointmentTime(list_AscmDeliveryNotifyMain, ref appointment_StartTime, ref appointment_EndTime);
                                if (list_AscmDeliveryNotifyMain != null && list_AscmDeliveryNotifyMain.Count() > 0)
                                {
                                    ascmDeliBatSumDetail.appointmentStartTime = appointment_StartTime;
                                    ascmDeliBatSumDetail.appointmentEndTime = appointment_EndTime;
                                }
                                #endregion
                                 * */
                                listAscmDeliBatSumDetailAdd.Add(ascmDeliBatSumDetail);
                            }
                        }
                        // 取送货通知预约时间
                        //List<AscmDeliveryNotifyMain> listAscmDeliveryNotifyMain = GetDeliveryNotifyList(listAscmDeliBatSumDetailAdd.Union(listAscmDeliBatSumDetail).ToList());
                        string appointmentStartTime = "", appointmentEndTime = "";
                        List<AscmDeliBatSumDetail> listAscmDeliBatSumDetailAll = new List<AscmDeliBatSumDetail>();
                        listAscmDeliBatSumDetailAll.AddRange(listAscmDeliBatSumDetail);
                        listAscmDeliBatSumDetailAll.AddRange(listAscmDeliBatSumDetailAdd);
                        AscmDeliBatSumMainService.GetInstance().GetAppointmentTime2(_supplierPassDuration, listAscmDeliBatSumDetailAll, ref appointmentStartTime, ref appointmentEndTime, !appointmentTimeFilter);
                        // 执行事务操作
                        //throw new Exception("error");
                        using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
                        {
                            try
                            {
                                if (listAscmDeliBatSumDetailAdd.Count > 0)
                                    YnDaoHelper.GetInstance().nHibernateHelper.SaveList(listAscmDeliBatSumDetailAdd);

                                if (ascmDeliBatSumMain.appointmentStartTime != appointmentStartTime || ascmDeliBatSumMain.appointmentEndTime != appointmentEndTime)
                                {
                                    ascmDeliBatSumMain.appointmentStartTime = appointmentStartTime;
                                    ascmDeliBatSumMain.appointmentEndTime = appointmentEndTime;
                                    YnDaoHelper.GetInstance().nHibernateHelper.Update(ascmDeliBatSumMain);
                                }

                                tx.Commit();//正确执行提交
                                jsonObjectResult.result = true;
                                jsonObjectResult.message = "";
                            }
                            catch (Exception ex)
                            {
                                tx.Rollback();//回滚
                                throw ex;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                jsonObjectResult.message = ex.Message;
            }
            return Json(jsonObjectResult, JsonRequestBehavior.AllowGet);
        }
        public DeliveryBatSumDetail GetDeliveryBatSumDetail(AscmDeliBatSumDetail detail, decimal totalQuantity)
        {
            DeliveryBatSumDetail deliveryBatSumDetail = null;
            if (detail != null)
            {
                deliveryBatSumDetail = new DeliveryBatSumDetail();
                deliveryBatSumDetail.id = detail.id;
                deliveryBatSumDetail.mainId = detail.mainId;
                deliveryBatSumDetail.barcode = detail.barcode == null ? string.Empty : detail.barcode;
                deliveryBatSumDetail.batchBarCode = detail.batchBarCode == null ? string.Empty : detail.batchBarCode;
                deliveryBatSumDetail.batchDocNumber = detail.batchDocNumber == null ? string.Empty : detail.batchDocNumber;
                deliveryBatSumDetail.materialDocNumber = detail.materialDocNumber == null ? string.Empty : detail.materialDocNumber;
                deliveryBatSumDetail.materialDescription = detail.materialDescription == null ? string.Empty : detail.materialDescription;
                deliveryBatSumDetail.materialUnit = detail.materialUnit == null ? string.Empty : detail.materialUnit;
                deliveryBatSumDetail.deliveryNumber = detail.totalNumber;
                deliveryBatSumDetail.containerBindNumber = detail.containerBindNumber;
                deliveryBatSumDetail.containerNumber = detail.containerNumber;
                deliveryBatSumDetail.comment = detail.batchComments == null ? string.Empty : detail.batchComments;
                deliveryBatSumDetail.wipEntities = detail.wipEntityNames == null ? string.Empty : detail.wipEntityNames;
                deliveryBatSumDetail.totalQuantity = totalQuantity;

                deliveryBatSumDetail.materialDescription = MideaAscm.Security.Utility.GetSubString(deliveryBatSumDetail.materialDescription, 50, "...");
                deliveryBatSumDetail.comment = MideaAscm.Security.Utility.GetSubString(deliveryBatSumDetail.comment, 10, "...");
                deliveryBatSumDetail.wipEntities = MideaAscm.Security.Utility.GetSubString(deliveryBatSumDetail.wipEntities, 70, "...");
            }
            return deliveryBatSumDetail;
        }