You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

166 lines
6.0 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using Newtonsoft.Json;
using XGL.Data;
using XGL.Model;
using CommonFunc;
/// <summary>
/// WMSInterFace 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]
// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。
// [System.Web.Script.Services.ScriptService]
public class WMSInterFace : System.Web.Services.WebService
{
public WMSInterFace()
{
//如果使用设计的组件,请取消注释以下行
//InitializeComponent();
}
//[WebMethod]
//public string HelloWorld()
//{
// return "Hello World";
//}
[WebMethod(Description = "挂起启动接口")]
public string Suspend(workdata_suspendinfo model)
{
ReturnValue rv = new ReturnValue();
try
{
if (model == null)
{
rv.FLAG = "false";
rv.MESSAGE = "没有传递数据,请核实";
Logger logger = new Logger();
logger.Error("接收到的参数为NULL");
}
else
{
string s= JsonConvert.SerializeObject(model);
Logger logger = new Logger();
logger.Log(s);
model.CreateTime = DateTime.Now;
model.IsDeleted = 0;
model.ModifyTime = DateTime.Now;
using (workdata_suspendinfoDB suspendinfoDB = new workdata_suspendinfoDB())
{
suspendinfoDB.Add(model);
using (basedata_orderplanDB orderplanDB = new basedata_orderplanDB())
{
basedata_orderplan orderplan = orderplanDB.GetModel(model.OrderNo);
if (orderplan != null)
{
orderplan.planState = Convert.ToInt32(model.STATUS);
orderplanDB.Update(orderplan);
}
}
rv.FLAG = "true";
rv.MESSAGE = "";
}
}
}
catch (Exception ex)
{
rv.FLAG = "false";
rv.MESSAGE = ex.Message;
Logger logger = new Logger();
logger.Error(ex.Message + "\r\n" + ex.StackTrace);
}
return JsonConvert.SerializeObject(rv);
}
[WebMethod(Description = "需求计划接口")]
public string OrderPlan(workdata_billinfo model)
{
ReturnValue rv = new ReturnValue();
try
{
//model.CreateTime = DateTime.Now;
//model.IsDeleted = 0;
//model.ModifyTime = DateTime.Now;
if (model == null)
{
rv.FLAG = "false";
rv.MESSAGE = "没有传递数据,请核实";
Logger logger = new Logger();
logger.Error("接收到的参数为NULL");
}
else
{
string s = JsonConvert.SerializeObject(model);
Logger logger = new Logger();
logger.Log(s);
using (workdata_billinfoDB billinfoDB = new workdata_billinfoDB())
{
billinfoDB.Add(model);
using (basedata_orderplanDB orderplanDB = new basedata_orderplanDB())
{
if (!orderplanDB.Exists(model.id))
{
basedata_orderplan orderplan = new basedata_orderplan();
orderplan.orderId = model.id;
orderplan.orderNo = model.orderNo;
//orderplan.timeOrderNo = model.timeOrderNo;
orderplan.productCode = model.productCode;
orderplan.productDesc = model.productDesc;
orderplan.factoryNo = model.factoryNo;
orderplan.matCode = model.matCode;
orderplan.matDesc = model.matDesc;
orderplan.amount = model.amount;
orderplan.line = model.line;
//orderplan.locCode = model.locCode;
//orderplan.sendSpot = model.sendSpot;
orderplan.orderStartDate = model.orderStartDate;
orderplan.orderEndDate = model.orderEndDate;
orderplan.planStartTime = model.orderStartTime;
orderplan.planType = model.type;
orderplan.PlanOrder = model.ORDER;
orderplan.Version = model.add1;
//orderplan.planState = model.;
//orderplan.planStartTime = model.planStartTime;
// orderplan.upAmount = model.upAmount;
//orderplan.downAount = model.downAount;
orderplanDB.Add(orderplan);
}
}
rv.FLAG = "true";
rv.MESSAGE = "";
}
}
}
catch (Exception ex)
{
rv.FLAG = "false";
rv.MESSAGE = ex.Message;
Logger logger = new Logger();
logger.Error(ex.Message + "\r\n" + ex.StackTrace);
}
return JsonConvert.SerializeObject(rv);
}
}
public class ReturnValue
{
public ReturnValue() { }
/// <summary>
/// 返回成功 success是 false否 (如果已经传入过了,那么也返回成功)
/// </summary>
public string FLAG { get; set; }
/// <summary>
/// 返回信息描述
/// </summary>
public string MESSAGE { get; set; }
}