Ejemplo n.º 1
0
        public static SimpleJson DeliverOrder4Package(ISession session, string orderNumber)
        {
            CRMSN shippingNotice = CRMSN.Retrieve(session, orderNumber);

            if (shippingNotice == null)
            {
                return(new SimpleJson().HandleError(string.Format("发货单{0}不存在", orderNumber)));
            }
            if (shippingNotice.Status != CRMSNStatus.Checked)
            {
                throw new Exception("发货单" + shippingNotice.OrderNumber + "没有核货或者已经包装完毕,无法执行包装作业");
            }
            return(shippingNotice.ToJSon(session));
        }
Ejemplo n.º 2
0
        public static SimpleJson DeliverOrder4Check(ISession session, string orderNumber)
        {
            CRMSN shippingNotice = CRMSN.Retrieve(session, orderNumber);

            if (shippingNotice == null)
            {
                return(new SimpleJson().HandleError(string.Format("发货单{0}不存在", orderNumber)));
            }
            if (shippingNotice.Status != CRMSNStatus.Distributing)
            {
                return(new SimpleJson().HandleError(string.Format("发货单{0}不是已打印状态,无法进行核货作业", shippingNotice.OrderNumber)));
            }
            SimpleJson json = shippingNotice.ToJSon(session);
            //是否需要过滤掉不必要核货的发货明细?
            DataSet ds = session.CreateObjectQuery(@"
select s.BarCode as SKU,m.ItemCode as ItemCode,m.ItemName as ItemName
    ,s.ColorCode as ColorCode,color.ColorText as ColorText,s.SizeCode as SizeCode
    ,sum(l.Quantity) as Quantity
from CRMSNLine l
inner join ItemSpec s on l.SKUID=s.SKUID
inner join ItemMaster m on m.ItemID=s.ItemID
left join ItemColor color on color.ColorCode=s.ColorCode
group by s.BarCode,m.ItemCode,m.ItemName,s.ColorCode,color.ColorText,s.SizeCode
order by s.BarCode")
                         .Attach(typeof(CRMSNLine)).Attach(typeof(ItemSpec)).Attach(typeof(ItemMaster))
                         .Attach(typeof(ItemColor))
                         .Where(Exp.Eq("l.SNID", shippingNotice.ID))
                         .DataSet();
            IList <SimpleJson> lineJson = new List <SimpleJson>(ds.Tables[0].Rows.Count);

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                lineJson.Add(new SimpleJson()
                             .Add("sku", row["SKU"])
                             .Add("itemCode", row["ItemCode"])
                             .Add("color", Cast.String(row["ColorCode"]) + " " + Cast.String(row["ColorText"]))
                             .Add("size", row["SizeCode"])
                             .Add("itemName", row["ItemName"])
                             .Add("qty", row["Quantity"]));
            }
            json.Add("lines", lineJson);
            return(json);
        }
Ejemplo n.º 3
0
        public static SimpleJson AddLine(ISession session, string icNumber, string snNumber)
        {
            if (string.IsNullOrEmpty(icNumber) || string.IsNullOrEmpty(snNumber))
            {
                throw new Exception("无效参数");
            }
            ICHead head = ICHead.Retrieve(session, icNumber);

            if (head == null)
            {
                throw new Exception("交接单" + icNumber + "不存在");
            }
            CRMSN sn = CRMSN.Retrieve(session, snNumber);

            if (sn == null)
            {
                throw new Exception("发货单" + snNumber + "不存在");
            }
            head.AddLine(session, sn);
            return(sn.ToJSon(session));
        }