public static void PackageFinish(ISession session, string orderNumber) { CRMSN head = CRMSN.Retrieve(session, orderNumber); if (head == null) { throw new Exception("发货单" + orderNumber + "不存在"); } if (head.Status != CRMSNStatus.Checked) { throw new Exception("发货单" + orderNumber + "没有核货或者已经包装完毕,无法执行包装作业"); } head.Status = CRMSNStatus.Packaged; head.PackageDate = DateTime.Now; head.PackagePerson = Security.SecuritySession.CurrentUser == null ? " " : Security.SecuritySession.CurrentUser.FullName; head.Update(session, "Status", "PackageDate", "PackagePerson"); }
public static void PackageSave(ISession session, string orderNumber, decimal packageWeight, string shippingNumber, int logisticId, string invoiceNumber, int packageCount) { CRMSN head = CRMSN.Retrieve(session, orderNumber); if (head == null) { throw new Exception("发货单" + orderNumber + "不存在"); } if (head.Status != CRMSNStatus.Checked) { throw new Exception("发货单" + orderNumber + "没有核货或者已经包装完毕,无法执行包装作业"); } IList <RestrictLogis2Member> restricts = session.CreateEntityQuery <RestrictLogis2Member>() .Where(Exp.Eq("MemberId", head.MemberID)) .List <RestrictLogis2Member>(); bool isInRestrict = false; string logisNames = ""; foreach (RestrictLogis2Member r in restricts) { Logistics logis = Logistics.Retrieve(session, r.LogisId); if (logis != null) { logisNames = logisNames + logis.ShortName + ", "; } if (r.LogisId == logisticId) { isInRestrict = true; } } if (restricts != null && restricts.Count > 0 && !isInRestrict) { throw new Exception("系统设置该会员只能通过\"" + logisNames.Substring(0, logisNames.Length - 2) + "\"发货"); } head.PackageWeight = packageWeight; head.ShippingNumber = shippingNumber; head.LogisticsID = logisticId; head.InvoiceNumber = invoiceNumber; head.PackageCount = packageCount; head.Update(session, "PackageWeight", "ShippingNumber", "LogisticsID", "InvoiceNumber", "PackageCount"); }
public static void CheckFinish(ISession session, string orderNumber) { if (string.IsNullOrEmpty(orderNumber) || orderNumber.Trim().Length <= 0) { throw new Exception("发货单号码为空,无法执行该操作"); } CRMSN head = CRMSN.Retrieve(session, orderNumber); if (head == null) { throw new Exception("发货单" + orderNumber + "不存在"); } if (head.Status != CRMSNStatus.Distributing) { return; } head.Status = CRMSNStatus.Checked; User user = User.Retrieve(session, Security.SecuritySession.CurrentUser.UserId); head.CheckPerson = user == null ? " " : user.FullName; head.CheckDate = DateTime.Now; head.Update(session, "Status", "CheckPerson", "CheckDate"); if (head._lines == null || head._lines.Count <= 0) { head._lines = session.CreateEntityQuery <CRMSNLine>() .Where(Exp.Eq("SNID", head.ID)) .OrderBy("SKUID").OrderBy("ID") .List <CRMSNLine>(); } foreach (CRMSNLine line in head._lines) { line.Status = CRMSNLineStatus.Checked; line.Update(session, "Status"); } head.WHTransactionDo(session); }