|
|
using System;
|
|
|
using System.Linq;
|
|
|
using System.Web.Mvc;
|
|
|
using DSWeb.MvcContainer.Models.MsOpCtnTkFitings;
|
|
|
using DSWeb.MvcContainer.DAL.MsOpCtnTkFitings;
|
|
|
using DSWeb.MvcShipping.Helper;
|
|
|
using DSWeb.MvcShipping.Comm.Cookie;
|
|
|
using System.Collections.Generic;
|
|
|
using HcUtility.Comm;
|
|
|
using HcUtility.Core;
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
using DSWeb.Areas.RptMng.Comm;
|
|
|
using System.Text;
|
|
|
using DSWeb.Areas.CommMng.Models;
|
|
|
using System.Data;
|
|
|
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
|
|
|
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
|
|
|
using DSWeb.MvcContainer.DAL.MsOpCtnBsCard;
|
|
|
|
|
|
namespace DSWeb.MvcContainer.Controllers
|
|
|
{
|
|
|
[JsonRequestBehavior]
|
|
|
public class MsOpCtnTkFitingsController : Controller
|
|
|
{
|
|
|
//
|
|
|
// GET:
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult Edit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult RptIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
public ActionResult CgIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult CgEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult DbIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult DbEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult BsIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult BsEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult KcIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult DbAuditIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult BsAuditIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult CtnKcIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult CtnKcView()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
//
|
|
|
// GET:
|
|
|
|
|
|
public ContentResult GetDataList(int start, int limit, string sort, string condition, string pricetype)
|
|
|
{
|
|
|
var dataList = MsOpCtnTkFitingsDAL.GetDataList(condition,sort);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetAuditDataList(int start, int limit, string sort, string condition, string pricetype)
|
|
|
{
|
|
|
var dataList = MsOpCtnTkFitingsDAL.GetAuditDataList(condition, sort);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetDataListStr(string sort, string condition, string pricetype)
|
|
|
{
|
|
|
var dataListStr = MsOpCtnTkFitingsDAL.GetDataListStr(condition,sort);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult GetData(string handle, string condition)
|
|
|
{
|
|
|
OpCtnTkFitings head = null;
|
|
|
|
|
|
if (handle == "edit")
|
|
|
{
|
|
|
head = MsOpCtnTkFitingsDAL.GetData(condition, Convert.ToString(Session["USERID"]));
|
|
|
}
|
|
|
|
|
|
if (head == null)
|
|
|
{
|
|
|
head = new OpCtnTkFitings();
|
|
|
head.CREATEUSER = Convert.ToString(Session["USERID"]);
|
|
|
head.CREATEUSERREF = Convert.ToString(Session["SHOWNAME"]);
|
|
|
}
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult Save(string opstatus, string data, string body,bool issub=false)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<OpCtnTkFitings>(data);
|
|
|
var bodyList = JsonConvert.Deserialize<List<OpCtnTkFitingsBody>>(body);
|
|
|
var errorstr = "";
|
|
|
var isPost = true;
|
|
|
if (opstatus == "add")
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
headData.CREATEUSER = Convert.ToString(Session["USERID"]);
|
|
|
headData.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
headData.BSSTATUS = "未提交";
|
|
|
}
|
|
|
else if (opstatus == "edit")
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
|
headData.ModelUIStatus = "E";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
|
}
|
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='配件管理'", Convert.ToString(Session["COMPANYID"]));
|
|
|
if (billnoset.BILLTYPE != "")
|
|
|
{
|
|
|
var bsdate = headData.OPDATE;
|
|
|
if (string.IsNullOrEmpty(bsdate)) bsdate = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
headData.BSNO = MsSysBillNoSetDAL.GetBillNo(billnoset, bsdate, bsdate);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
errorstr = "配件管理的编号规则未设置,请先设置编号生成规则!";
|
|
|
isPost = false;
|
|
|
}
|
|
|
var GID = headData.GID;
|
|
|
if (headData.OPDATE == "") headData.OPDATE = null;
|
|
|
headData.MODIFIEDUSER = Convert.ToString(Session["USERID"]);
|
|
|
headData.MODIFIEDTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
if (bodyList != null && bodyList.Count != 0)
|
|
|
{
|
|
|
if (headData.OPTYPE == "调拨" || headData.OPTYPE == "报损")
|
|
|
{
|
|
|
var kcList = MsOpCtnTkFitingsDAL.GetFitingsKcList("YARD='" + headData.YARD + "'");
|
|
|
foreach (var detail in bodyList) {
|
|
|
var kc = kcList.Find(x => x.FITINGGID == detail.FITINGGID);
|
|
|
if (kc == null || kc.PKGS < detail.PKGS) {
|
|
|
|
|
|
errorstr = "配件出库数量大于库存数量!";
|
|
|
isPost = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
if (isPost)
|
|
|
{
|
|
|
var modb = new ModelObjectDB();
|
|
|
var result = modb.Save(headData);
|
|
|
if (result.Success == true)
|
|
|
{
|
|
|
MsOpCtnTkFitingsDAL.SaveFitingsBody(bodyList, GID, Convert.ToString(Session["USERID"]));
|
|
|
}
|
|
|
|
|
|
if (issub)
|
|
|
{
|
|
|
var auditresult = MsOpCtnTkFitingsDAL.SubmitAuditBillNew(headData, Convert.ToString(Session["USERID"]));
|
|
|
if (auditresult.Success&&auditresult.Message2=="1")
|
|
|
{
|
|
|
MsOpCtnTkFitingsDAL.SaveCgFitingsDetail(headData,headData.OPTYPE,Convert.ToString(Session["USERID"]));
|
|
|
MsOpCtnTkFitingsDAL.UpdateFitingsKc();
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
Data = MsOpCtnTkFitingsDAL.GetData("GID='" + GID + "'", Convert.ToString(Session["USERID"]))
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
else {
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = errorstr };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
}
|
|
|
public ContentResult SubmitAuditBackForm(string data)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<OpCtnTkFitings>(data);
|
|
|
DBResult result = MsOpCtnTkFitingsDAL.CancelAuditBill(headData, Convert.ToString(Session["USERID"]));
|
|
|
if (result.Success)
|
|
|
{
|
|
|
MsOpCtnTkFitingsDAL.SaveCgFitingsDetail(headData, headData.OPTYPE, Convert.ToString(Session["USERID"]));
|
|
|
MsOpCtnTkFitingsDAL.UpdateFitingsKc();
|
|
|
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
Data = ""
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
public ContentResult AuditBillList(string bill)
|
|
|
{
|
|
|
|
|
|
var billData = JsonConvert.Deserialize<List<OpCtnTkFitings>>(bill);
|
|
|
DBResult result = MsOpCtnTkFitingsDAL.AuditBillList(billData, Convert.ToString(Session["USERID"]));
|
|
|
|
|
|
var json = JsonConvert.Serialize(result);
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult AuditBillDbOverList(string bill,string OPDATE2)
|
|
|
{
|
|
|
|
|
|
var billData = JsonConvert.Deserialize<List<OpCtnTkFitings>>(bill);
|
|
|
DBResult result = MsOpCtnTkFitingsDAL.AuditBillDbOverList(billData, OPDATE2,Convert.ToString(Session["USERID"]));
|
|
|
|
|
|
var json = JsonConvert.Serialize(result);
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult AuditBillBack(String bill, string reasean)
|
|
|
{
|
|
|
|
|
|
var billData = JsonConvert.Deserialize<List<OpCtnTkFitings>>(bill);
|
|
|
DBResult result = MsOpCtnTkFitingsDAL.AuditBillBack(billData, Convert.ToString(Session["USERID"]), reasean, Convert.ToString(Session["COMPANYID"]));
|
|
|
if (result.Success&& result.Message2=="1") {
|
|
|
MsOpCtnTkFitingsDAL.UpdateFitingsKc();
|
|
|
}
|
|
|
|
|
|
var json = JsonConvert.Serialize(result);
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult Delete(string data)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<List<OpCtnTkFitings>>(data);
|
|
|
if (headData != null && headData.Count != 0) {
|
|
|
foreach (var head in headData) {
|
|
|
if (head.BSSTATUS != "未提交") {
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "当前状态不允许删除!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
if (MsOpCtnTkFitingsDAL.GetBodyCount(head.GID)) {
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "存在配件明细,不允许删除!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
DBResult result = MsOpCtnTkFitingsDAL.DeleteOpCtnTkFitings(headData);
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult GetFitingsDetailList(string condition, string sort)
|
|
|
{
|
|
|
var dataList = MsOpCtnTkFitingsDAL.GetFitingsDetailList(condition, sort);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetFitingsDetailListStr(string condition, string sort)
|
|
|
{
|
|
|
var dataListStr = MsOpCtnTkFitingsDAL.GetFitingsDetailListStr(condition, sort);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult SaveFitingsDetail(string Fitingsbody, string linkgid)
|
|
|
{
|
|
|
//
|
|
|
var bodyList = JsonConvert.Deserialize<List<OpCtnTkFitingsDetail>>(Fitingsbody);
|
|
|
var opctnbscard = MsOpCtnBsCardDAL.GetData("GID='" + linkgid + "'", "");
|
|
|
DBResult result = new DBResult();
|
|
|
if (bodyList != null && bodyList.Count != 0)
|
|
|
{
|
|
|
var KcList = MsOpCtnTkFitingsDAL.GetFitingsKcList("");
|
|
|
var CtnKcList = MsOpCtnTkFitingsDAL.GetFitingsCtnKcList("F.CTNGID='"+opctnbscard.CTNGID+"'");
|
|
|
foreach (var body in bodyList) {
|
|
|
if (body.WMSTYPE == "装")
|
|
|
{
|
|
|
var kc = KcList.Find(x => x.YARD == body.YARD && x.FITINGGID == body.FITINGGID);
|
|
|
if (kc != null)
|
|
|
{
|
|
|
if (kc.PKGS < body.PKGS)
|
|
|
{
|
|
|
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "配件:" + body.FITINGNAME + ",所装数量大于库存数量,不允许此操作!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "配件:" + body.FITINGNAME + ",库存不存在,无法‘装’!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else {
|
|
|
var kc = CtnKcList.Find(x =>x.FITINGGID == body.FITINGGID);
|
|
|
if (kc != null)
|
|
|
{
|
|
|
if (kc.PKGS < body.PKGS)
|
|
|
{
|
|
|
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "配件:" + body.FITINGNAME + ",所拆或损坏数量大于在此罐数量,不允许此操作!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "配件:" + body.FITINGNAME + ",在此罐不存在,无法‘拆’或‘损坏’!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
result = MsOpCtnTkFitingsDAL.SaveFitingsDetail(opctnbscard,bodyList, linkgid, Convert.ToString(Session["USERID"]));
|
|
|
if (result.Success)
|
|
|
{
|
|
|
MsOpCtnTkFitingsDAL.UpdateFitingsKc();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult DeleteFitingsDetail(string data)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<List<OpCtnTkFitingsDetail>>(data);
|
|
|
|
|
|
DBResult result = MsOpCtnTkFitingsDAL.DeleteFitingsDetail(headData);
|
|
|
if (result.Success)
|
|
|
{
|
|
|
MsOpCtnTkFitingsDAL.UpdateFitingsKc();
|
|
|
}
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult GetFitingsBodyList(string condition, string sort)
|
|
|
{
|
|
|
var dataList = MsOpCtnTkFitingsDAL.GetFitingsBodyList(condition, sort);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetFitingsBodyListStr(string condition, string sort)
|
|
|
{
|
|
|
var dataListStr = MsOpCtnTkFitingsDAL.GetFitingsBodyListStr(condition, sort);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult DeleteFitingsBody(string data)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<List<OpCtnTkFitingsBody>>(data);
|
|
|
|
|
|
DBResult result = MsOpCtnTkFitingsDAL.DeleteFitingsBody(headData);
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetFitingsKcList(string condition, string sort)
|
|
|
{
|
|
|
var dataList = MsOpCtnTkFitingsDAL.GetFitingsKcList(condition, sort);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetFitingsKcListStr(string condition, string sort)
|
|
|
{
|
|
|
var dataListStr = MsOpCtnTkFitingsDAL.GetFitingsKcListStr(condition, sort);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetFitingsCtnKcList(string condition, string sort)
|
|
|
{
|
|
|
var dataList = MsOpCtnTkFitingsDAL.GetFitingsCtnKcList(condition, sort);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetFitingsCtnKcListStr(string condition, string sort)
|
|
|
{
|
|
|
var dataListStr = MsOpCtnTkFitingsDAL.GetFitingsCtnKcListStr(condition, sort);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetFitingsBsCardCtnKcList(string condition, string sort)
|
|
|
{
|
|
|
var dataList = MsOpCtnTkFitingsDAL.GetFitingsBsCardCtnKcList(condition, sort);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult SaveBsCardFitingsDetail(string Fitingsbody)
|
|
|
{
|
|
|
//
|
|
|
var bodyList = JsonConvert.Deserialize<List<OpCtnTkFitingsDetail>>(Fitingsbody);
|
|
|
DBResult result = new DBResult();
|
|
|
if (bodyList != null && bodyList.Count != 0)
|
|
|
{
|
|
|
var KcList = MsOpCtnTkFitingsDAL.GetFitingsKcList("");
|
|
|
foreach (var body in bodyList)
|
|
|
{
|
|
|
var CtnKcList = MsOpCtnTkFitingsDAL.GetFitingsCtnKcList("F.CTNGID='" + body.CTNGID + "'");
|
|
|
|
|
|
|
|
|
if (body.WMSTYPE == "装")
|
|
|
{
|
|
|
var kc = KcList.Find(x => x.YARD == body.YARD && x.FITINGGID == body.FITINGGID);
|
|
|
if (kc != null)
|
|
|
{
|
|
|
if (kc.PKGS < body.PKGS)
|
|
|
{
|
|
|
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "配件:" + body.FITINGNAME + ",所装数量大于库存数量,不允许此操作!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "配件:" + body.FITINGNAME + ",库存不存在,无法‘装’!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var kc = CtnKcList.Find(x => x.FITINGGID == body.FITINGGID);
|
|
|
if (kc != null)
|
|
|
{
|
|
|
if (kc.PKGS < body.PKGS)
|
|
|
{
|
|
|
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "配件:" + body.FITINGNAME + ",所拆或损坏数量大于在此罐数量,不允许此操作!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "配件:" + body.FITINGNAME + ",在此罐不存在,无法‘拆’或‘损坏’!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
result = MsOpCtnTkFitingsDAL.SaveBsCardFitingsBody(bodyList,Convert.ToString(Session["USERID"]));
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
public ContentResult AuditBsCardFitingsBody(string Fitingsbody)
|
|
|
{
|
|
|
//
|
|
|
var bodyList = JsonConvert.Deserialize<List<OpCtnTkFitingsDetail>>(Fitingsbody);
|
|
|
DBResult result = new DBResult();
|
|
|
if (bodyList != null && bodyList.Count != 0)
|
|
|
{
|
|
|
var KcList = MsOpCtnTkFitingsDAL.GetFitingsKcList("");
|
|
|
foreach (var body in bodyList)
|
|
|
{
|
|
|
var CtnKcList = MsOpCtnTkFitingsDAL.GetFitingsCtnKcList("F.CTNGID='" + body.CTNGID + "'");
|
|
|
|
|
|
|
|
|
if (body.WMSTYPE == "装")
|
|
|
{
|
|
|
var kc = KcList.Find(x => x.YARD == body.YARD && x.FITINGGID == body.FITINGGID);
|
|
|
if (kc != null)
|
|
|
{
|
|
|
if (kc.PKGS < body.PKGS)
|
|
|
{
|
|
|
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "配件:" + body.FITINGNAME + ",所装数量大于库存数量,不允许此操作!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "配件:" + body.FITINGNAME + ",库存不存在,无法‘装’!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var kc = CtnKcList.Find(x => x.FITINGGID == body.FITINGGID);
|
|
|
if (kc != null)
|
|
|
{
|
|
|
if (kc.PKGS < body.PKGS)
|
|
|
{
|
|
|
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "配件:" + body.FITINGNAME + ",所拆或损坏数量大于在此罐数量,不允许此操作!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "配件:" + body.FITINGNAME + ",在此罐不存在,无法‘拆’或‘损坏’!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
result = MsOpCtnTkFitingsDAL.AuditBsCardFitingsBody(bodyList, Convert.ToString(Session["USERID"]));
|
|
|
if (result.Success)
|
|
|
{
|
|
|
MsOpCtnTkFitingsDAL.UpdateFitingsKc();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
#region 参照部分
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|