Exemplo n.º 1
0
 public void CreateBillofLadingMaster(ShipmentMaster shipmentMaster)
 {
     genericMgr.Create(shipmentMaster);
     foreach (var shipmentDetail in shipmentMaster.ShipmentDetails)
     {
         genericMgr.Create(shipmentDetail); 
     }
 }
Exemplo n.º 2
0
 public void DeleteBillofLadingMaster(ShipmentMaster billofLadingMaster)
 {
     genericMgr.Delete(billofLadingMaster.ShipmentDetails);
     genericMgr.Delete(billofLadingMaster);
     
 }
        public ActionResult checkdCreateShipmentMaster(string checkedIpNos, string VehicleNo, string Driver, string Shipper, string CaseQty,string  AddressTo)
        {

            string[] checkeIpNoArray = checkedIpNos.Split(',');

            IList<IpMaster> ipMasterList = genericMgr.FindAllIn<IpMaster>("from IpMaster where IpNo in (?", checkeIpNoArray);
            List<Region> regionList = new List<Region>();
            foreach (var IpMasterEntity in ipMasterList)
            {
                Region region = genericMgr.FindById<Region>(IpMasterEntity.PartyFrom);
                regionList.Add(region);
            }
           
            if (regionList.Select(r => r.Workshop).Distinct().Count() > 1)
            {
                throw new BusinessException(Resources.EXT.ControllerLan.Con_PlantsOfSelectedShipOrderInconsistent);
            }
            ShipmentMaster shipmentMaster = new ShipmentMaster();
            shipmentMaster.WorkShop = regionList[0].Workshop;
            shipmentMaster.Shipper = Shipper;
            shipmentMaster.AddressTo = AddressTo;
            shipmentMaster.ShipmentNo = numberControlMgr.GetShipmentNo();
            shipmentMaster.CaseQty = CaseQty == "" ? 0 : Convert.ToInt32(CaseQty);
            shipmentMaster.VehicleNo = VehicleNo;
            shipmentMaster.Driver = Driver;
            shipmentMaster.Status = com.Sconit.CodeMaster.BillMasterStatus.Create;




            IList<ShipmentDetail> shipmentDetaillList = new List<ShipmentDetail>();
            foreach (IpMaster ipMaster in ipMasterList)
            {
                ShipmentDetail shipmentDetail = new ShipmentDetail();
                shipmentDetail.ShipmentNo = shipmentMaster.ShipmentNo;
                shipmentDetail.IpNo = ipMaster.IpNo;
                shipmentDetaillList.Add(shipmentDetail);
            }
            shipmentMaster.ShipmentDetails = shipmentDetaillList;

            try
            {
                billofLadingMgr.CreateBillofLadingMaster(shipmentMaster);
                object obj = Resources.EXT.ControllerLan.Con_ShippingOrderNumber + shipmentMaster.ShipmentNo + Resources.EXT.ControllerLan.Con_GeneratedSuccessfully;
                object ShipmentNo = shipmentMaster.ShipmentNo;
                return Json(new { status = obj, ShipmentNo = ShipmentNo }, "text/plain");
            }
            catch (BusinessException ex)
            {
                Response.TrySkipIisCustomErrors = true;
                Response.StatusCode = 500;

                Response.Write(ex.GetMessages()[0].GetMessageString());
            }
            return Json(null);


        }
        public JsonResult CreateShipmentMaster(string VehicleNo, string Driver, string Shipper, string CaseQty,string AddressTo)
        {
            IList<IpMaster> ipMasterList = (IList<IpMaster>)TempData["IpMaster"];
            try
            {
            if (ipMasterList.Count == 0)
            {
                throw new BusinessException(Resources.EXT.ControllerLan.Con_AtLeastScanOneShipOrder);
            }
            ShipmentMaster shipmentMaster = new ShipmentMaster();
            shipmentMaster.Shipper = Shipper;
            shipmentMaster.AddressTo = AddressTo;
            shipmentMaster.ShipmentNo = numberControlMgr.GetShipmentNo();
            shipmentMaster.CaseQty = CaseQty == "" ? 0 : Convert.ToInt32(CaseQty);
            shipmentMaster.VehicleNo = VehicleNo;
            shipmentMaster.Driver = Driver;
            shipmentMaster.Status = com.Sconit.CodeMaster.BillMasterStatus.Create;


            IList<ShipmentDetail> shipmentDetailList = new List<ShipmentDetail>();
            foreach (IpMaster ipMaster in ipMasterList)
            {
                ShipmentDetail biDetail = new ShipmentDetail();
                biDetail.ShipmentNo = shipmentMaster.ShipmentNo;
                biDetail.IpNo = ipMaster.IpNo;
                shipmentDetailList.Add(biDetail);
               
            }
            shipmentMaster.WorkShop = genericMgr.FindById<Region>(ipMasterList[0].PartyFrom).Workshop;
            shipmentMaster.ShipmentDetails = shipmentDetailList;


            billofLadingMgr.CreateBillofLadingMaster(shipmentMaster);
            object obj = Resources.EXT.ControllerLan.Con_ShippingOrderNumber + shipmentMaster.ShipmentNo + Resources.EXT.ControllerLan.Con_GeneratedSuccessfully;
            object ShipmentNo = shipmentMaster.ShipmentNo;
            return Json(new { status = obj, ShipmentNo = ShipmentNo }, "text/plain");
            }
            catch (BusinessException ex)
            {
                Response.TrySkipIisCustomErrors = true;
                Response.StatusCode = 500;

                Response.Write(ex.GetMessages()[0].GetMessageString());
            }
            return Json(null);


        }
        /*
         * 填充报表头
         * 
         * Param pageIndex 页号
         * Param orderHead 订单头对象
         * Param orderDetails 订单明细对象
         */
        protected void FillHead(ShipmentMaster ShipmentMaster)
        {
            //运单号:
            string orderCode = Utility.BarcodeHelper.GetBarcodeStr(ShipmentMaster.ShipmentNo, this.barCodeFontName);
            this.SetRowCell(0, 4, orderCode);
            //ShipmentNo No.:
            this.SetRowCell(1, 4, ShipmentMaster.ShipmentNo);

            //车牌:
            this.SetRowCell(2, 1, ShipmentMaster.VehicleNo);

            //驾驶员 Supplier Code:	
            this.SetRowCell(3, 1, ShipmentMaster.Driver);
            //目的地
            this.SetRowCell(3, 4, ShipmentMaster.AddressTo);


            //承运商:		
            this.SetRowCell(4, 1, ShipmentMaster.Shipper);
            //数量
            this.SetRowCell(4, 4, ShipmentMaster.CaseQty);

            //创建用户:	
            this.SetRowCell(5, 1, ShipmentMaster.CreateUserName);
            //创建时间
            this.SetRowCell(5, 4, ShipmentMaster.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"));

            //供应商联系人 Contact:	
            this.SetRowCell(7, 1, ShipmentMaster.PassPerson);
            //目的库位
            this.SetRowCell(7, 4, ShipmentMaster.PassDate.HasValue? ShipmentMaster.PassDate.Value.ToString("yyyy-MM-dd HH:mm:ss"):"" );

       

        }
        public ActionResult checkdCreateShipmentMaster(string checkedIpNos, string VehicleNo, string Driver, string Shipper, string CaseQty, string AddressTo)
        {

            string[] checkeIpNoArray = checkedIpNos.Split(',');


            string selectStatement = string.Empty;
            IList<object> param = new List<object>();
            foreach (var IpNo in checkeIpNoArray)
            {
                if (selectStatement == string.Empty)
                {
                    selectStatement = "from IpMaster where IpNo in (?";
                }
                else
                {
                    selectStatement += ",?";
                }
                param.Add(IpNo);
            }
            selectStatement += ")";

            IList<IpMaster> ipMasterList = base.genericMgr.FindAll<IpMaster>(selectStatement, param.ToArray());

            List<Region> regionList = new List<Region>();
            foreach (var IpMasterEntity in ipMasterList)
            {
                Region region = base.genericMgr.FindById<Region>(IpMasterEntity.PartyFrom);
                regionList.Add(region);
            }

            if (regionList.Select(r => r.Workshop).Distinct().Count() > 1)
            {
                throw new BusinessException("所选送货单的分厂不一致,请从新选择");
            }
            ShipmentMaster shipmentMaster = new ShipmentMaster();
            shipmentMaster.WorkShop = regionList[0].Workshop;
            shipmentMaster.Shipper = Shipper;
            shipmentMaster.AddressTo = AddressTo;
            shipmentMaster.ShipmentNo = numberControlMgr.GetBillOfLadingNo();
            shipmentMaster.CaseQty = CaseQty == "" ? 0 : Convert.ToInt32(CaseQty);
            shipmentMaster.VehicleNo = VehicleNo;
            shipmentMaster.Driver = Driver;
            shipmentMaster.Status = com.Sconit.CodeMaster.BillMasterStatus.Create;




            IList<ShipmentDetail> shipmentDetaillList = new List<ShipmentDetail>();
            foreach (IpMaster ipMaster in ipMasterList)
            {
                ShipmentDetail shipmentDetail = new ShipmentDetail();
                shipmentDetail.ShipmentNo = shipmentMaster.ShipmentNo;
                shipmentDetail.IpNo = ipMaster.IpNo;
                shipmentDetaillList.Add(shipmentDetail);
            }
            shipmentMaster.ShipmentDetails = shipmentDetaillList;

            try
            {
                shipmentMgr.CreateBillofLadingMaster(shipmentMaster);
                SaveSuccessMessage("运单号:" + shipmentMaster.ShipmentNo + "生成成功!");
                return Json(new { ShipmentNo = shipmentMaster.ShipmentNo });
            }
            catch (BusinessException ex)
            {
                SaveBusinessExceptionMessage(ex);
            }
            catch (Exception ex)
            {
                SaveErrorMessage(ex);
            }
            return Json(null);
        }
        public JsonResult CreateShipmentMaster(string VehicleNo, string Driver, string Shipper, string CaseQty, string AddressTo)
        {
            IList<IpMaster> ipMasterList = (IList<IpMaster>)TempData["IpMaster"];
            try
            {
                if (ipMasterList.Count == 0)
                {
                    throw new BusinessException("至少扫描一张送货单!");
                }
                ShipmentMaster shipmentMaster = new ShipmentMaster();
                shipmentMaster.Shipper = Shipper;
                shipmentMaster.AddressTo = AddressTo;
                shipmentMaster.ShipmentNo = numberControlMgr.GetBillOfLadingNo();
                shipmentMaster.CaseQty = CaseQty == "" ? 0 : Convert.ToInt32(CaseQty);
                shipmentMaster.VehicleNo = VehicleNo;
                shipmentMaster.Driver = Driver;
                shipmentMaster.Status = com.Sconit.CodeMaster.BillMasterStatus.Create;


                IList<ShipmentDetail> shipmentDetailList = new List<ShipmentDetail>();
                foreach (IpMaster ipMaster in ipMasterList)
                {
                    ShipmentDetail biDetail = new ShipmentDetail();
                    biDetail.ShipmentNo = shipmentMaster.ShipmentNo;
                    biDetail.IpNo = ipMaster.IpNo;
                    shipmentDetailList.Add(biDetail);

                }
                shipmentMaster.WorkShop = base.genericMgr.FindById<Region>(ipMasterList[0].PartyFrom).Workshop;
                shipmentMaster.ShipmentDetails = shipmentDetailList;


                shipmentMgr.CreateBillofLadingMaster(shipmentMaster);
                SaveSuccessMessage("运单号:" + shipmentMaster.ShipmentNo + "生成成功!");
                return Json(new { ShipmentNo = shipmentMaster.ShipmentNo });
            }
            catch (BusinessException ex)
            {
                SaveBusinessExceptionMessage(ex);
            }
            catch (Exception ex)
            {
                SaveErrorMessage(ex);
            }
            return Json(null);


        }