using System.Dynamic;
using Microsoft.AspNetCore.Mvc;
using NewPdaSqlServer.Dto.service;
using NewPdaSqlServer.entity;
using NewPdaSqlServer.service.@base;
using NewPdaSqlServer.service.Wom;
using NewPdaSqlServer.util;
namespace NewPdaSqlServer.Controllers.Wom;
[ApiController]
[Route("api/[controller]")]
public class WomdaaController : ControllerBase
{
private readonly WomdaaManager m = new();
private readonly MesPrintMangeer _mCf = new();
#region 生产领料
//GetProductionPickDaa001
///
/// 模糊查询工单号并返回
///
///
[HttpPost("GetProductionPickDaa001")]
public ResponseResult GetProductionPickDaa001(WarehouseQuery query)
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.GetProductionPickDaa001(query);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
//GetItemsByDaa001
///
/// 根据工单号获取代领物料明细
///
///
[HttpPost("GetItemsByDaa001")]
public ResponseResult GetItemsByDaa001(WarehouseQuery query)
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.GetItemsByDaa001(query);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
//ScanCode
[HttpPost("ScanCode")]
public ResponseResult ScanCode(WarehouseQuery query)
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.ScanCode(query);
if(resultInfos.tbBillList.result == "2")
{
return new ResponseResult
{
status = Convert.ToInt32(resultInfos.tbBillList.result),
message = resultInfos.tbBillList.strMsg,
data = resultInfos
};
}
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
//ScanCodeCF
[HttpPost("ScanCodeCF")]
public ResponseResult ScanCodeCF(WarehouseQuery query)
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = new ExpandoObject();
resultInfos.tbBillList.printInfo = _mCf.getPrintInfo(query);
var scanResult = m.ScanCodeCF(query);
resultInfos.tbBillList.cfBarInfo = _mCf.getCfInfo(scanResult);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
///
/// 获取所有
///
///
[HttpPost("GetList")]
public ResponseResult GetList()
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.GetList();
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
///
/// 根据主键获取
///
///
[HttpPost("GetById")]
public ResponseResult GetById(int id)
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.GetById(id);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
///
/// 根据主键删除
///
///
[HttpPost("DeleteByIds")]
public ResponseResult DeleteByIds([FromBody] object[] ids)
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.DeleteByIds(ids);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
///
/// 添加
///
///
[HttpPost("Insert")]
public ResponseResult Add([FromBody] Womdaa data)
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.Insert(data);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
///
/// 添加返回自增
///
///
[HttpPost("InsertReturnIdentity")]
public ResponseResult InsertReturnIdentity([FromBody] Womdaa data)
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.InsertReturnIdentity(data);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
///
/// 修改
///
///
[HttpPost("Update")]
public ResponseResult Update([FromBody] Womdaa data)
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.Update(data);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
#endregion
#region 现场管理
///
/// 扫描注塑码,获取工单和条码信息
///
///
[HttpPost("getZsBarInfo")]
public ResponseResult getZsBarInfo([FromBody] dynamic query)
{
try
{
dynamic resultInfos = new ExpandoObject();
// 先初始化tbBillList属性
resultInfos.tbBillList = new ExpandoObject();
resultInfos.tbBillList.ZsBarInfo = m.getZsBarInfo(query);
resultInfos.tbBillList.Traceability = m.getTraceability(query);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
///
/// 产品绑定,追溯码和流水码绑定
///
///
[HttpPost("ProductBinding")]
public ResponseResult ProductBinding([FromBody] dynamic query)
{
try
{
dynamic resultInfos = new ExpandoObject();
// 先初始化tbBillList属性
resultInfos.tbBillList = new ExpandoObject();
resultInfos.tbBillList = m.ProductBinding(query);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
///
/// 获取卡板信息
///
///
[HttpPost("getKbBarInfo")]
public ResponseResult getKbBarInfo([FromBody] dynamic query)
{
try
{
dynamic resultInfos = new ExpandoObject();
// 先初始化tbBillList属性
resultInfos.tbBillList = new ExpandoObject();
resultInfos.tbBillList.KbBarInfo = m.getKbBarInfo(query);
resultInfos.tbBillList.KbBarMxInfo = m.getKbBarMxInfo(query);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
///
/// 获取箱码信息
///
///
[HttpPost("getXBarInfo")]
public ResponseResult getXBarInfo([FromBody] dynamic query)
{
try
{
dynamic resultInfos = new ExpandoObject();
// 先初始化tbBillList属性
resultInfos.tbBillList = new ExpandoObject();
resultInfos.tbBillList.XBarInfo = m.getXBarInfo(query);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
///
/// 绑定箱码与托板码
///
///
[HttpPost("submitAllChecked")]
public ResponseResult submitAllChecked([FromBody] dynamic query)
{
try
{
dynamic resultInfos = new ExpandoObject();
// 先初始化tbBillList属性
resultInfos.tbBillList = new ExpandoObject();
resultInfos.tbBillList = m.submitAllChecked(query);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
///
/// 核对送检
///
///
[HttpPost("submitInspection")]
public ResponseResult submitInspection([FromBody] dynamic query)
{
try
{
dynamic resultInfos = new ExpandoObject();
// 先初始化tbBillList属性
resultInfos.tbBillList = new ExpandoObject();
resultInfos.tbBillList = m.SubmitKbInspection(query);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
//GetItemsXcsl
///
/// 根据工单号获取待收料物料明细
///
///
[HttpPost("GetItemsXcsl")]
public ResponseResult GetItemsXcsl(WarehouseQuery query)
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.GetItemsXcsl(query);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
//GetItemsXcsl
///
/// 物料条码收料
///
///
[HttpPost("ScanXcsl")]
public ResponseResult ScanXcsl(dynamic query)
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.ScanXcsl(query);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
//GetItemsXcsl
///
/// 根据线体获取仪器重量
///
///
[HttpPost("GetWeightByXt")]
public ResponseResult GetWeightByXt(dynamic query)
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.GetWeightByXt(query);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
///
/// 现场收料获取可选工单信息
///
///
///
[HttpPost("GetXcslDaa")]
public ResponseResult GetXcslDaa([FromBody] dynamic query)
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.GetXcslDaa(query);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
#endregion
}