コード例 #1
0
        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);


        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);


        }
コード例 #4
0
        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);


        }